|
||||||||||
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.discovery.components.DiscPingManager
The DiscPingManager is the thread responsible to send and receive the PING requests to discover nodes It maintains a pool of DiscPingerThreads to send out the PING requests. These threads read off the m_pingRequestQ to which the IPGenerator queues node and send out the requests to the icmpd It also has a DiscPingReplyReceiver thread that recieves all the filtered replies from the icmpd and queues it back to the main thread. Once a reply is received, the manager notifies the DiscPinger thread that was in charge of sending out the request for which the reply has been received so that it stops any retries that might be pending and starts on the next address Once a reply has been received, the capsd is informed about the new node found
Inner Class Summary | |
private static class |
DiscPingManager.AddressToSoapDocument
This static class is used to build an compliant SOAP document that is sent to the capabilities daemon. |
private class |
DiscPingManager.ManagerClient
Extends the PollerClient class to allow the string constructor to be called. |
Field Summary | |
private static long |
BASE_MONITOR_THREADID
Base thread id for the monitor pinger threads...this value distinguishes a thread in the monitor pool from a thread in the discovery pool. |
private boolean |
bMonitorThreadPoolCreated
True if the monitor thread pool has already been created and the MonitorPinger threads started. |
private static int |
INIT_NUM_MONITOR_POLLERS
the initial number of monitor pinger threads |
private com.sun.media.jsdt.Channel |
m_channel
JSDT channel that capsd is listening on |
private PollerClient |
m_client
JSDT client identifier of this thread |
private short |
m_filterID
Filter to be used for communication with icmpd |
private int |
m_maxNumMonitorThreads
Max number of MonitorPinger threads to create. |
private List |
m_monitorPollers
MonitorPinger thread pool |
private com.sun.media.jsdt.Channel |
m_monitorReplyChannel
|
private PollerClient |
m_monitorReplyClient
|
private PCQueue |
m_monitorRequestQ
queue to which MonitorRequestReceiver adds the next address to ping |
private com.sun.media.jsdt.Session |
m_monitorSession
|
private List |
m_pollers
thread pool |
private DaemonConnection |
m_portal
icmpd portal |
private DiscPingReplyReceiver |
m_receiver
ping receiver thread |
private PCQueue |
m_replyQ
queue to which DiscReplyReceiver adds the address whose ping reply was received |
private PCQueue |
m_requestQ
queue to which IPGenerator adds the next address to ping |
private com.sun.media.jsdt.Session |
m_session
JSDT session in which discovery and capsd communicate |
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 | |
DiscPingManager(int port,
long nThreads,
long nPktsPerSec,
PCQueue requestQ,
int maxMonitorThreads,
PCQueue monitorRequestQ)
The ping manager's constructor is used to initialize the connection to the icmpd, open the jsdt connections, and startup the pinger thread pool. |
Method Summary | |
private MonitorPinger |
getMonitorPingSender(long threadID)
Find the MonitorPinger thread that was assigned to send ping packets for this IP Address. |
boolean |
getOkResponse(DaemonConnection dc)
Get's the response message from the icmp daemon and checks it for a zero return code. |
private DiscPinger |
getPingSender(long threadID)
Find the thread that was assigned to send ping packets for this IP Address. |
private boolean |
jsdtConnect(String name)
Creates a connection to the JSDT registry and also creates the session for sending updates about discovered nodes. |
private boolean |
jsdtConnectMonitor(String name)
Creates a connection to the JSDT registry and also creates the session/channel through which the MonitorPinger threads will send poll results to the ICMP service monitor. |
void |
run()
Wait for a notify() - the thread is notified if there is a status change or by the DiscReplyReciever thread if a reply has been received for any ping request Everytime it is interrupted from a wait, it checks for a status change - if there is a status change, appropriate action is taken if the status is normal, it means a reply has been received, it reads from the recieve Q, informs the pinger thread that sent the request out, informs capsd and goes back to waiting |
void |
shutdown()
Initiates the shutdown sequence and waits for the ping manager thread to exit. |
protected void |
threadsVsQueueSizeCheck()
After each read from the monitorRequestQ, the threads in the monitor thread pool call this method to adjust the number of threads in the pool if necessary If the number of entries in the queue is more than double the number of threads, the number of threads is increased by one until the configurable maximum number of threads is reached |
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 PCQueue m_requestQ
private PCQueue m_monitorRequestQ
private PCQueue m_replyQ
private List m_pollers
private DiscPingReplyReceiver m_receiver
private short m_filterID
private PollerClient m_client
private com.sun.media.jsdt.Session m_session
private com.sun.media.jsdt.Channel m_channel
private DaemonConnection m_portal
private com.sun.media.jsdt.Session m_monitorSession
private com.sun.media.jsdt.Channel m_monitorReplyChannel
private PollerClient m_monitorReplyClient
private List m_monitorPollers
private int m_maxNumMonitorThreads
private boolean bMonitorThreadPoolCreated
private static int INIT_NUM_MONITOR_POLLERS
private static final long BASE_MONITOR_THREADID
Constructor Detail |
public DiscPingManager(int port, long nThreads, long nPktsPerSec, PCQueue requestQ, int maxMonitorThreads, PCQueue monitorRequestQ) throws IOException
The ping manager's constructor is used to initialize the connection to the icmpd, open the jsdt connections, and startup the pinger thread pool. In addition is also starts the icmp receiver thread for discovery and prepares the thread for prime time.
port
- The port for the icmpd connectionnThreads
- The number of poller threads to createnPktsPerSec
- The limiter number for sending icmp messages.PCQueue
- The input icmp request queue to be managed.nThreads
- The maximum number of monitor poller threads to createPCQueue
- A 2nd icmp request Q for incoming ICMP Service Monitor requestsIOException
- Thrown if an error occurs with
the icmpd connection.RuntimeException
- Thrown if an error occurs setting
up threads or the JSDT collaboritive environment.Method Detail |
private boolean jsdtConnect(String name) throws InterruptedException
Creates a connection to the JSDT registry and also creates the session for sending updates about discovered nodes.
name
- The name of the new client.InterruptedException
- Thrown if the thread
is interrupted while attempting to setup the jsdt connection.private boolean jsdtConnectMonitor(String name) throws InterruptedException
Creates a connection to the JSDT registry and also creates the session/channel through which the MonitorPinger threads will send poll results to the ICMP service monitor.
name
- The name of the new client.InterruptedException
- Thrown if the thread
is interrupted while attempting to setup the jsdt connection.protected void threadsVsQueueSizeCheck()
private DiscPinger getPingSender(long threadID)
Find the thread that was assigned to send ping packets for this IP Address.
threadID
- the id of the thread to findprivate MonitorPinger getMonitorPingSender(long threadID)
Find the MonitorPinger thread that was assigned to send ping packets for this IP Address.
threadID
- the id of the thread to findpublic boolean getOkResponse(DaemonConnection dc) throws IOException
Get's the response message from the icmp daemon and checks it for a zero return code. If an I/O error occurs then an exception is thrown. The value of the boolean return indicates the success or failure of the last message
dc
- The connection to the icmp daemonIOException
- Thrown if there is an error
communicating with the icmpd.public void run()
run
in class Thread
public void shutdown()
Initiates the shutdown sequence and waits for the ping manager thread to exit.
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 |