OpenNMS API 1.2.3

org.opennms.netmgt.notifd
Class DefaultQueueHandler

java.lang.Object
  extended byorg.opennms.netmgt.notifd.DefaultQueueHandler
All Implemented Interfaces:
Fiber, NotifdQueueHandler, PausableFiber, java.lang.Runnable

public class DefaultQueueHandler
extends java.lang.Object
implements NotifdQueueHandler

This class is used as a thread for executing notices for events that are discovered by the notice daemon. The notices are read from an scheduler queue and the processes are created by the fiber. Each created process is added to garbage collection list that is periodically polled and culled based upon the status of the process or how long the process is run. If the process has run long than allocated it is terminated during collection.

Author:
Jason Johns ,
Field Summary
private  long m_interval
          How long to sleep between processing more notices
private  NoticeQueue m_noticeQueue
          The input queue of runnable commands.
private  java.lang.String m_queueID
          The name of this Fiber
private  int m_status
          The status of this fiber.
 
Fields inherited from interface org.opennms.core.fiber.PausableFiber
PAUSE_PENDING, PAUSED, RESUME_PENDING
 
Fields inherited from interface org.opennms.core.fiber.Fiber
RUNNING, START_PENDING, STARTING, STATUS_NAMES, STOP_PENDING, STOPPED
 
Constructor Summary
DefaultQueueHandler()
           
 
Method Summary
 java.lang.String getName()
          Returns the name of this fiber.
 int getStatus()
          Returns the current status of the pausable fiber.
 void pause()
          Pauses a currently running fiber.
 void processQueue()
           
 void resume()
          Resumes the fiber if it is paused.
 void run()
          The main worker of the fiber.
 void setInterval(java.lang.String interval)
           
 void setNoticeQueue(NoticeQueue noticeQueue)
           
 void setQueueID(java.lang.String queueID)
           
 void start()
          Starts the fiber.
 void stop()
          Stops a currently running fiber.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_noticeQueue

private NoticeQueue m_noticeQueue
The input queue of runnable commands.


m_queueID

private java.lang.String m_queueID
The name of this Fiber


m_interval

private long m_interval
How long to sleep between processing more notices


m_status

private int m_status
The status of this fiber.

Constructor Detail

DefaultQueueHandler

public DefaultQueueHandler()
Method Detail

setQueueID

public void setQueueID(java.lang.String queueID)
Specified by:
setQueueID in interface NotifdQueueHandler

setNoticeQueue

public void setNoticeQueue(NoticeQueue noticeQueue)
Specified by:
setNoticeQueue in interface NotifdQueueHandler

setInterval

public void setInterval(java.lang.String interval)
Specified by:
setInterval in interface NotifdQueueHandler

run

public void run()
The main worker of the fiber. This method is executed by the encapsualted thread to read commands from the execution queue and to execute those commands. If the thread is interrupted or the status changes to STOP_PENDING then the method will return as quickly as possible.

Specified by:
run in interface java.lang.Runnable

processQueue

public void processQueue()
Specified by:
processQueue in interface NotifdQueueHandler

start

public void start()
Starts the fiber. If the fiber has already been run or is currently running then an exception is generated. The status of the fiber is updated to STARTING and will transisition to RUNNING when the fiber finishes initializing and begins processing the encapsulaed queue.

Specified by:
start in interface Fiber
Throws:
java.lang.IllegalStateException - Thrown if the fiber is stopped or has never run.

stop

public void stop()
Stops a currently running fiber. If the fiber has already been stopped then the command is silently ignored. If the fiber was never started then an exception is generated.

Specified by:
stop in interface Fiber
Throws:
java.lang.IllegalStateException - Thrown if the fiber was never started.

pause

public void pause()
Pauses a currently running fiber. If the fiber was not in a running or resuming state then the command is silently discarded. If the fiber is not running or has terminated then an exception is generated.

Specified by:
pause in interface PausableFiber
Throws:
java.lang.IllegalStateException - Thrown if the fiber is stopped or has never run.

resume

public void resume()
Resumes the fiber if it is paused. If the fiber was not in a paused or pause pending state then the request is discarded. If the fiber has not been started or has already stopped then an exception is generated.

Specified by:
resume in interface PausableFiber
Throws:
java.lang.IllegalStateException - Thrown if the fiber is stopped or has never run.

getName

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

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

getStatus

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

Specified by:
getStatus in interface Fiber
Returns:
The current status of the fiber.
See Also:
PausableFiber, Fiber

OpenNMS API 1.2.3

Generated by eevans on May 29 2005 2015.