OpenNMS API 1.2.3

org.opennms.netmgt.xmlrpcd
Class EventQueueProcessor

java.lang.Object
  extended byorg.opennms.netmgt.xmlrpcd.EventQueueProcessor
All Implemented Interfaces:
Fiber, PausableFiber, java.lang.Runnable

class EventQueueProcessor
extends java.lang.Object
implements java.lang.Runnable, PausableFiber

The EventQueueProcessor processes the events recieved by xmlrpcd and sends notifications to the external XMLRPC server via XMLRPC protocol.

Author:
James Zuo , OpenNMS.org

Field Summary
private  FifoQueue m_eventQ
          The input queue
private  int m_maxQSize
          The max size of the event queue
private  XmlRpcNotifier m_notifier
          An object used to communicate with exteranl xmlrpc servers
private  int m_status
          Current status of the fiber
private  java.lang.Thread m_worker
          The thread that is executing the run method on behalf of the 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
(package private) EventQueueProcessor(FifoQueue eventQ, XmlrpcServer[] rpcServers, int retries, int elapseTime, boolean verifyServer, java.lang.String localServer, int maxQSize)
          The constructor
 
Method Summary
 java.lang.String getName()
          Returns the name of the fiber.
 int getStatus()
          Returns the current status of the fiber
 void pause()
          Pauses the current fiber.
private  void processEvent(Event event)
           
private  void pushBackEvent(Event event)
          Push the event back to the event queue if OpenNMS failed to send message to the external XMLRPC server, so that it could be send to the server again later.
 void resume()
          Resumes the currently paused fiber.
 void run()
          Reads off of the event queue and depends on the uei of the event of read, process the event to send a notification to the external XMLRPC server via XMLRPC protocol.
 void start()
          Starts the current fiber.
private  boolean statusOK()
          Returns true if the status is ok and the thread should continue running.
 void stop()
           Stops this fiber.
private  void xmlrpcNotificationEventHandler(Event event)
          Process xmlrpcNotificationEvent according the status flag to determine to send a notifyReceivedEvent, or a notifySuccess, or a notifyFailure notification to XMLRPC Server.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_eventQ

private FifoQueue m_eventQ
The input queue


m_maxQSize

private int m_maxQSize
The max size of the event queue


m_notifier

private XmlRpcNotifier m_notifier
An object used to communicate with exteranl xmlrpc servers


m_status

private int m_status
Current status of the fiber


m_worker

private java.lang.Thread m_worker
The thread that is executing the run method on behalf of the fiber.

Constructor Detail

EventQueueProcessor

EventQueueProcessor(FifoQueue eventQ,
                    XmlrpcServer[] rpcServers,
                    int retries,
                    int elapseTime,
                    boolean verifyServer,
                    java.lang.String localServer,
                    int maxQSize)
The constructor

Method Detail

processEvent

private void processEvent(Event event)

xmlrpcNotificationEventHandler

private void xmlrpcNotificationEventHandler(Event event)
Process xmlrpcNotificationEvent according the status flag to determine to send a notifyReceivedEvent, or a notifySuccess, or a notifyFailure notification to XMLRPC Server.


pushBackEvent

private void pushBackEvent(Event event)
Push the event back to the event queue if OpenNMS failed to send message to the external XMLRPC server, so that it could be send to the server again later.


statusOK

private boolean statusOK()
Returns true if the status is ok and the thread should continue running. If the status returend is false then the thread should exit.


start

public void start()
Starts the current fiber. If the fiber has already been started, regardless of it's current state, then an IllegalStateException is thrown.

Specified by:
start in interface Fiber
Throws:
java.lang.IllegalStateException - Thrown if the fiber has already been started.

pause

public void pause()
Pauses the current fiber.

Specified by:
pause in interface PausableFiber

resume

public void resume()
Resumes the currently paused fiber.

Specified by:
resume in interface PausableFiber

stop

public void stop()

Stops this fiber. If the fiber has never been started then an IllegalStateExceptio is generated.

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

getName

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

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 status of the Fiber.

run

public void run()
Reads off of the event queue and depends on the uei of the event of read, process the event to send a notification to the external XMLRPC server via XMLRPC protocol.

Specified by:
run in interface java.lang.Runnable

OpenNMS API 1.2.3

Generated by eevans on May 29 2005 2015.