|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.avalon.framework.logger.AbstractLogEnabled
org.apache.excalibur.instrument.AbstractLogEnabledInstrumentable
org.apache.excalibur.instrument.manager.http.server.AbstractLogEnabledInstrumentableStartable
org.apache.excalibur.instrument.manager.http.server.AbstractSocketServer
abstract class AbstractSocketServer
| Field Summary | |
|---|---|
private int |
m_backlog
The backlog to assign to the server socket. |
private java.net.InetAddress |
m_bindAddr
The address to bind the port server to. |
private org.apache.excalibur.instrument.CounterInstrument |
m_instrumentConnects
Number of times that the server socket is connected to. |
private org.apache.excalibur.instrument.CounterInstrument |
m_instrumentDisconnects
Number of times that a connection socket disconnects. |
private org.apache.excalibur.instrument.ValueInstrument |
m_instrumentOpenSockets
Number of sockets that are connected at any given time. |
private java.util.List |
m_openSockets
Used to track the number of open sockets. |
private int |
m_port
The port to listen on for connections. |
private java.lang.Object |
m_semaphore
Semaphore used to synchronize actions contained in this class. |
private java.net.ServerSocket |
m_serverSocket
Reference to the ServerSocket. |
private long |
m_shutdownTimeout
The time in ms after the component starts to shutdown that sockets will have to shutdown on their own before they are closed. |
private int |
m_soTimeout
The SO_TIMEOUT to use for client sockets. |
private boolean |
m_started
Flag which keeps track of when the server has been started. |
| Fields inherited from interface org.apache.excalibur.instrument.Instrumentable |
|---|
EMPTY_INSTRUMENT_ARRAY, EMPTY_INSTRUMENTABLE_ARRAY |
| Constructor Summary | |
|---|---|
AbstractSocketServer(int port,
java.net.InetAddress bindAddress)
Creates a new AbstractSocketServer. |
|
| Method Summary | |
|---|---|
protected int |
getSoTimeout()
|
protected abstract void |
handleSocket(java.net.Socket socket)
Handle a newly connected socket. |
private void |
handleSocketInner(java.net.Socket socket)
Keeps track of instrumentation related to the life of a socket as well as handles any errors encountered while handling the socket in the user code. |
protected void |
runner()
Runner method that will be called when the component is started. |
void |
start()
Starts the runner thread. |
protected void |
stopRunner()
Called when the component is being stopped, the isStopping method will always return true when this method is called. |
| Methods inherited from class org.apache.excalibur.instrument.manager.http.server.AbstractLogEnabledInstrumentableStartable |
|---|
isStopping, run, stop |
| Methods inherited from class org.apache.excalibur.instrument.AbstractLogEnabledInstrumentable |
|---|
addChildInstrumentable, addInstrument, getChildInstrumentables, getInstrumentableName, getInstruments, setInstrumentableName |
| Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled |
|---|
enableLogging, getLogger, setupLogger, setupLogger, setupLogger |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private java.lang.Object m_semaphore
private int m_port
private int m_backlog
private java.net.InetAddress m_bindAddr
private int m_soTimeout
private long m_shutdownTimeout
private boolean m_started
private java.net.ServerSocket m_serverSocket
private java.util.List m_openSockets
private org.apache.excalibur.instrument.CounterInstrument m_instrumentConnects
private org.apache.excalibur.instrument.ValueInstrument m_instrumentOpenSockets
private org.apache.excalibur.instrument.CounterInstrument m_instrumentDisconnects
| Constructor Detail |
|---|
public AbstractSocketServer(int port,
java.net.InetAddress bindAddress)
port - The port on which the server will listen.bindAddress - The address on which the server will listen for
connections.| Method Detail |
|---|
public void start()
throws java.lang.Exception
start in interface org.apache.avalon.framework.activity.Startablestart in class AbstractLogEnabledInstrumentableStartablejava.lang.Exception - If there are any problems.
protected void stopRunner()
throws java.lang.Exception
stopRunner in class AbstractLogEnabledInstrumentableStartablejava.lang.Exception - If there are any problemsprotected void runner()
runner in class AbstractLogEnabledInstrumentableStartableprotected abstract void handleSocket(java.net.Socket socket)
socket - Newly connected Socket to be handled.private void handleSocketInner(java.net.Socket socket)
socket - The socket to be handled.protected int getSoTimeout()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||