|
||||||||||
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.common.components.RunnableConsumerThread
The RunnableConsumerThread class is an extension of the PollerThread class. The extension class is really just a consumer of objects that implement the Runnable interface. When the object is consumed from the input queue it's run() method is invoked. After the run() method on the consumed object returns, the Runnable object is enqueued on an output queue if any exist. If no output queue exists then the object is discarded by the RunnableConsumerThread.
Runnable
Field Summary | |
private PCQueue |
m_input
The Producer/Consumer Queue where Runnable Objects are dequeued and run by the run() method. |
private PCQueue |
m_output
The Producer/Consumer Queue where the Runnable objects from the input queue are placed when their run() method returns. |
static int |
STATUS_BUSY
This defines the thread specific bits that mask the thread as busy when its status is STATUS_NORMAL. |
static int |
STATUS_IDLE
This defines the thread specific bits that mark the thread as idle when its status is STATUS_NORMAL. |
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 | |
RunnableConsumerThread(PCQueue input)
Constructs a thread consumer of objects that implement the Runnable interface. |
|
RunnableConsumerThread(PCQueue input,
PCQueue output)
Constructs a consumer of objects that implement the Runnable interface. |
|
RunnableConsumerThread(String name,
PCQueue input)
Constructs a thread consumer of objects that implement the Runnable interface. |
|
RunnableConsumerThread(String name,
PCQueue input,
PCQueue output)
Constructs a consumer of objects that implement the Runnable interface. |
|
RunnableConsumerThread(ThreadGroup grp,
String name,
PCQueue input)
Constructs a thread consumer of objects that implement the Runnable interface. |
|
RunnableConsumerThread(ThreadGroup grp,
String name,
PCQueue input,
PCQueue output)
Constructs a threadconsumer of objects that implement the Runnable interface. |
Method Summary | |
void |
run()
The run() method is actually invoked by the Thread base class and calls the run() method for each Runnable object dequeued by the class. |
Methods inherited from class org.opennms.bb.dp.common.components.PollerThread |
getCtrlStatus, getOpStatus, pauseOperation, pauseThread, resumeOperation, resumeThread, setCtrlStatus, setOpStatus, setUserStatus, shutdown, 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_input
The Producer/Consumer Queue where Runnable Objects are dequeued and run by the run() method.
private PCQueue m_output
The Producer/Consumer Queue where the Runnable objects from the input queue are placed when their run() method returns. If the queue is null then the Runnable objects are discarded.
public static final int STATUS_IDLE
This defines the thread specific bits that mark the thread as idle when its status is STATUS_NORMAL.
public static final int STATUS_BUSY
This defines the thread specific bits that mask the thread as busy when its status is STATUS_NORMAL.
Constructor Detail |
public RunnableConsumerThread(PCQueue input)
Constructs a thread consumer of objects that implement the Runnable interface. The objects are consumed from the input queue specified in the constructor.
input
- The source of the runnable objects.IllegalArgumentException
- Thrown if the
input queue is not valid.public RunnableConsumerThread(PCQueue input, PCQueue output)
Constructs a consumer of objects that implement the Runnable interface. The objects are consumed from the input queue specified in the constructor. Once the runnable objects have had their run() method invoked and return the objects are then enqueued on the output queue.
input
- The source of the runnable objects.output
- The destination of the spent runnable objects.IllegalArgumentException
- Thrown if the
input or output queue are not valid.public RunnableConsumerThread(String name, PCQueue input)
Constructs a thread consumer of objects that implement the Runnable interface. The objects are consumed from the input queue specified in the constructor. The name of the thread is specified in the constructor.
name
- The thread name supplied to base class.input
- The source of the runnable objects.IllegalArgumentException
- Thrown if the
input queue is not valid.public RunnableConsumerThread(String name, PCQueue input, PCQueue output)
Constructs a consumer of objects that implement the Runnable interface. The objects are consumed from the input queue specified in the constructor. Once the runnable objects have had their run() method invoked and return the objects are then enqueued on the output queue.
name
- The thread name supplied to the base class.input
- The source of the runnable objects.output
- The destination of the spent runnable objects.IllegalArgumentException
- Thrown if the
input or output queue are not valid.public RunnableConsumerThread(ThreadGroup grp, String name, PCQueue input)
Constructs a thread consumer of objects that implement the Runnable interface. The objects are consumed from the input queue specified in the constructor. The actual thread is created as a member of the ThreadGroup grp.
grp
- The thread group for the new thread.name
- The thread name to pass to the base class.input
- The source of the runnable objects.IllegalArgumentException
- Thrown if the
input queue is not valid.public RunnableConsumerThread(ThreadGroup grp, String name, PCQueue input, PCQueue output)
Constructs a threadconsumer of objects that implement the Runnable interface. The objects are consumed from the input queue specified in the constructor. Once the runnable objects have had their run() method invoked and return the objects are then enqueued on the output queue. The thread is created in the passed thread group with the passed name.
grp
- The thread group for membership.name
- The name of the new thread.input
- The source of the runnable objects.output
- The destination of the spent runnable objects.IllegalArgumentException
- Thrown if the
input or output queue are not valid.Method Detail |
public void run()
The run() method is actually invoked by the Thread base class and calls the run() method for each Runnable object dequeued by the class. The method ensures that the status of the object is kept updated as it dequeues, runs, and enqueues the runnables.
If the thread is paused the run() method may not transition to paused until the current runnable object, if any, completes. Likewise the thread will not terminate until the current runnable returns control to the thread.
run
in class Thread
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |