|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.lang.Thread | +--org.opennms.bb.dp.common.components.PollerThread | +--org.opennms.bb.dp.eventd.TCPHandler
TCPHandler handles TCP connections to the eventd. For each conenction accepted, it creates a 'SocketShadowInputStream' object to pass the input stream of the socket to be parsed for events
TCPHandler extends the PollerThread for the pause/resume/shutdown functionality
Inner Class Summary | |
private static class |
TCPHandler.ConnectionHandler
When the TCPHandler blocks on the 'accept()', there is no reliable way to interrupt the thread on a status change. |
private static class |
TCPHandler.Counter
The counter class is used to ensure that the count is kept accurate when multiple threads could be trying to adjust the count at the same time. |
private class |
TCPHandler.SocketShadowInputStream
An input stream that is a a shadow of the socket's input stream except that on a close(), the socket is closed so that the input stream is still open for parse - the input stream is closed after the parse is complete |
Field Summary | |
private static int |
CONN_BACKLOG
the length of the queue of connections |
private TCPHandler.Counter |
m_connections
the current number of connections being handled - is updated during the creation and close of the inner class SocketShadowInputStream |
private TCPHandler.ConnectionHandler |
m_handler
The connection handler that accepts connections and queues them back to the main thread |
private PCQueue |
m_readerQ
queue of the EventsReaders |
private ServerSocket |
m_server
The socket on which eventd/eventListener listens for TCP connections |
private PCQueue |
m_tcpQ
queue between the inner class that accepts new connections and the main thread |
private static int |
numEventsRcvd
|
Fields inherited from class org.opennms.bb.dp.common.components.PollerThread |
m_curOpStatus, STATUS_MASK, STATUS_NORMAL, STATUS_PAUSED, STATUS_PAUSING, STATUS_RESUMING, STATUS_SHUTDOWN, STATUS_STARTING, STATUS_TERMINATING |
Fields inherited from class java.lang.Thread |
contextClassLoader, daemon, eetop, group, inheritableThreadLocals, inheritedAccessControlContext, MAX_PRIORITY, MIN_PRIORITY, name, NORM_PRIORITY, priority, single_step, stillborn, stopThreadPermission, target, threadInitNumber, threadLocals, threadQ |
Constructor Summary | |
(package private) |
TCPHandler(int port,
PCQueue readerQ)
Instantiate the TCPHandler at the said port with the default name |
(package private) |
TCPHandler(String name,
int port,
PCQueue readerQ)
Instantiate the TCPHandler at the said port with the specified name |
Method Summary | |
void |
run()
The main method that keeps track of status changes and reads accepted connections from the 'tcpQ'. |
void |
shutdown()
Shutdown operation. |
void |
start()
Start operation |
Methods inherited from class org.opennms.bb.dp.common.components.PollerThread |
getCtrlStatus, getOpStatus, pauseOperation, pauseThread, resumeOperation, resumeThread, setCtrlStatus, setOpStatus, setUserStatus, shutdownThread |
Methods inherited from class java.lang.Thread |
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
private static final int CONN_BACKLOG
private ServerSocket m_server
private PCQueue m_readerQ
private PCQueue m_tcpQ
private TCPHandler.ConnectionHandler m_handler
private TCPHandler.Counter m_connections
private static int numEventsRcvd
Constructor Detail |
TCPHandler(int port, PCQueue readerQ) throws IOException
port
- port number to be used by the handlerreaderQ
- queue to which the incoming events are to be addedIOException
- Thrown if communication port cannot be set uporg.apache.sax.SAXException
- Thrown if the event parser pool cannot be createdTCPHandler(String name, int port, PCQueue readerQ) throws IOException
name
- name of this threadport
- port number to be used by the handlerreaderQ
- queue to which the incoming events are to be addedIOException
- Thrown if communication port cannot be set uporg.apache.sax.SAXException
- Thrown if the event parser pool cannot be createdMethod Detail |
public void run()
run
in class Thread
public void start()
start
in class Thread
public void shutdown()
shutdown
in class PollerThread
org.opennms.bb.dp.common.components.PollerThread
PollerThread.STATUS_TERMINATING
,
Object.notifyAll()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |