|
||||||||||
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.UDPHandler
UDPHandler extends the PollerThread for the pause/resume/shutdown functionality
It handles all the events sent to eventd via UDP. It handles events that are 16K or lesser in size
Comments: Some code adpated/changed from Rick's initial code for eventd - sk
Inner Class Summary | |
private static class |
UDPHandler.DatagramPacketHandler
When the UDPHandler blocks on the 'receive()', there is no reliable way to interrupt the thread on a status change. |
Field Summary | |
private static int |
BUF_SIZE
Buffer size used for input |
private UDPHandler.DatagramPacketHandler |
m_handler
The datagram packet handler that accepts datagram packets and queues them back to the main thread |
private PCQueue |
m_readerQ
queue to the eventExpander |
private DatagramSocket |
m_server
UDP socket on which events are received |
private PCQueue |
m_udpQ
queue between the inner class that accepts new datagram packets 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) |
UDPHandler(int port,
PCQueue readerQ)
Constructs a handler listening at the port 'port' |
Method Summary | |
void |
run()
The main method of the UDPHandler that reads the datagram packets from the 'udpQ'. |
private int |
setUpComm()
Called to setup the communications channel buffers. |
void |
shutdown()
Initiates the shutdown sequence and waits for this thread to exit. |
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 BUF_SIZE
private PCQueue m_readerQ
private DatagramSocket m_server
private PCQueue m_udpQ
private UDPHandler.DatagramPacketHandler m_handler
private static int numEventsRcvd
Constructor Detail |
UDPHandler(int port, PCQueue readerQ) throws SocketException
eListener
- the event listenerport
- port number on which this handler is to listenreaderQ
- queue to which incoming events are to be adddedthrows
- java.net.SocketException if the socket cannot
be opened or if it cannot bind to the port numberthrows
- org.xml.sax.SAXException if the events parser cannot be createdMethod Detail |
private int setUpComm()
public void run()
run
in class Thread
public void start()
start
in class Thread
public void shutdown()
Initiates the shutdown sequence and waits for this thread to exit.
Close the datagram socket and the internal queue and shutdown the datagram packet reciever threadshutdown
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 |