OpenNMS API 1.2.3

org.opennms.core.concurrent
Class RunnableConsumerThreadPool.FiberThreadImpl

java.lang.Object
  extended byorg.opennms.core.concurrent.RunnableConsumerThreadPool.FiberThreadImpl
All Implemented Interfaces:
Fiber, java.lang.Runnable
Enclosing class:
RunnableConsumerThreadPool

private class RunnableConsumerThreadPool.FiberThreadImpl
extends java.lang.Object
implements Fiber, java.lang.Runnable

This class implements the Fiber interface on top of a Java Threadinstance. These fibers are the basic unit of work in the pool structure. Each fiber reads from the input queue and calls the run method on the associated instance. When finished the fiber invoked the appropriate callback and then repeats the process.

Author:
Brian Weaver , OpenNMS

Field Summary
private  java.lang.Thread m_delegateThread
          The core thread that is running this fiber.
private  boolean m_shutdown
          if set true then the thread should exist as soon as possible.
private  int m_status
          The status of this fiber.
 
Fields inherited from interface org.opennms.core.fiber.Fiber
RUNNING, START_PENDING, STARTING, STATUS_NAMES, STOP_PENDING, STOPPED
 
Constructor Summary
(package private) RunnableConsumerThreadPool.FiberThreadImpl(java.lang.String name)
          Constructs a new fiber thread and adds the instance to the pool.
 
Method Summary
 java.lang.String getName()
          Returns the name of the thread.
 int getStatus()
          Returns the current status of the fiber.
 void run()
           The run method preforms the actual work for the fiber.
 void start()
          Starts up the thread.
 void stop()
          Sets the stop flag in the thread.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_delegateThread

private java.lang.Thread m_delegateThread
The core thread that is running this fiber.


m_shutdown

private volatile boolean m_shutdown
if set true then the thread should exist as soon as possible.


m_status

private volatile int m_status
The status of this fiber.

Constructor Detail

RunnableConsumerThreadPool.FiberThreadImpl

RunnableConsumerThreadPool.FiberThreadImpl(java.lang.String name)
Constructs a new fiber thread and adds the instance to the pool.

Parameters:
name - The name of the fiber.
Method Detail

run

public void run()

The run method preforms the actual work for the fiber. It loops infinitely until the shutdown flag is set, during which time it processes queue elements. Each element in the queue should be a instance of Runnable. After each instance is recieved its run method is invoked.

After the object's run method completes it is passed to any interested callers via the listener list in the encapsulated class.

Specified by:
run in interface java.lang.Runnable

start

public void start()
Starts up the thread.

Specified by:
start in interface Fiber

stop

public void stop()
Sets the stop flag in the thread.

Specified by:
stop in interface Fiber

getName

public java.lang.String getName()
Returns the name of the thread.

Specified by:
getName in interface Fiber
Returns:
The name of the Fiber.

getStatus

public int getStatus()
Returns the current status of the fiber.

Specified by:
getStatus in interface Fiber
Returns:
The current status of the Fiber.

OpenNMS API 1.2.3

Generated by eevans on May 29 2005 2015.