org.opennms.bb.dp.capsd.components
Class CapsdReadManager

java.lang.Object
  |
  +--java.lang.Thread
        |
        +--org.opennms.bb.dp.common.components.PollerThread
              |
              +--org.opennms.bb.dp.capsd.components.CapsdReadManager
All Implemented Interfaces:
Runnable

public class CapsdReadManager
extends PollerThread

CapsdReadManager is responsible to query the IPAddresses received from discovery for the SNMP information. It maintains a pool of RunnableConsumerThreads that take input (CapsReader) from the discRecvQ, send out the SNMP query requests and then adds the CapsReader object to the databaseQ.

Version:
$Revision: 1.12 $
Author:
Sowmya, OpenNMS

Field Summary
private  PCQueue m_capsPropReadQ
          Input queue to the RunnableConsumerThreads.
private  PCQueue m_databaseQ
          The backside queue for the RunnableConsumerThread instances.
private  PCQueue m_discRecvQ
          The queue to which the newly discovered nodes from discovery are received.
private  Set m_dupNodes
          Set of nodes (ip addresses) already known by Capsd
private  List m_plugins
          The list containing the service plugin objects.
private  List m_threads
          The list of RunnableConsumerThreads used to execute the CapsReader objects.
private static int NUM_READERS
          The number of RunnableConsumerThreads that should be started by the manager.
 
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
private CapsdReadManager()
          The default constructor for the class.
  CapsdReadManager(PCQueue discRecvQ, PCQueue databaseQ, List servicePlugins, Set dupNodes)
          Creates a new CapsdReadManager that creates a RunnableConsumerThread thread pool.
 
Method Summary
 void run()
          The run method is the core of the object in terms of managing the consumer threads and enqueuing objects for the consumers.
 void shutdown()
          Start the shutdown and notify run() to shutdown
 
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
, activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, exit, getContextClassLoader, getName, getPriority, getThreadGroup, init, interrupt, interrupt0, interrupted, isAlive, isDaemon, isInterrupted, isInterrupted, join, join, join, nextThreadNum, registerNatives, resume, resume0, setContextClassLoader, setDaemon, setName, setPriority, setPriority0, sleep, sleep, start, stop, stop, stop0, suspend, suspend0, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

m_discRecvQ

private PCQueue m_discRecvQ

The queue to which the newly discovered nodes from discovery are received.


m_capsPropReadQ

private PCQueue m_capsPropReadQ

Input queue to the RunnableConsumerThreads. CapsReader objects are added to the queue so when these run they query the nodes for SNMP info and the services status.


m_databaseQ

private PCQueue m_databaseQ

The backside queue for the RunnableConsumerThread instances. Once the objects are actually executed via their run methods, the completed object is palced into this queue.


m_threads

private List m_threads

The list of RunnableConsumerThreads used to execute the CapsReader objects.


NUM_READERS

private static final int NUM_READERS

The number of RunnableConsumerThreads that should be started by the manager.


m_plugins

private List m_plugins

The list containing the service plugin objects.


m_dupNodes

private Set m_dupNodes
Set of nodes (ip addresses) already known by Capsd
Constructor Detail

CapsdReadManager

private CapsdReadManager()
                  throws UnsupportedOperationException

The default constructor for the class. The constructor is not supported and will always throw an unsupported operation exception.

Throws:
UnsupportedOperationException - Always thrown by the constructor.

CapsdReadManager

public CapsdReadManager(PCQueue discRecvQ,
                        PCQueue databaseQ,
                        List servicePlugins,
                        Set dupNodes)

Creates a new CapsdReadManager that creates a RunnableConsumerThread thread pool. The instance manages the thread pool and the queueus that are the source of information for the runnable consumer classes.

Parameters:
discRecvQ - The queue to which the newly discovered nodes from discovery are added.
databaseQ - The queue to which nodes are added after the SNMP and plugin queries are completed - output Q to the RunnableConsumerThread(s).
servicePlugins - The list that contains all the service plugins with each plugin having its capability name class to handle the plugin etc.
dupNodes - The set that contains all the addresses already known to Capsd.
Throws:
IllegalArgumentException - Thrown if either of the passed queues are null.
Method Detail

run

public void run()

The run method is the core of the object in terms of managing the consumer threads and enqueuing objects for the consumers. When the run method is first called the consumer threads are started. After the threads are started the method monitors for status changes and transforms discovery messages into CapsReader objects for the runnable consumers.

Overrides:
run in class Thread

shutdown

public void shutdown()
Start the shutdown and notify run() to shutdown
Overrides:
shutdown in class PollerThread
Following copied from class: org.opennms.bb.dp.common.components.PollerThread
See Also:
PollerThread.STATUS_TERMINATING, Object.notifyAll()