org.opennms.bb.dp.eventd
Class JSDTHandler

java.lang.Object
  |
  +--org.opennms.bb.dp.eventd.JSDTHandler
All Implemented Interfaces:
com.sun.media.jsdt.ChannelConsumer, Serializable

public class JSDTHandler
extends Object
implements com.sun.media.jsdt.ChannelConsumer

JSDTHandler handles all the events sent to Eventd via JSDT

It extends the PollerClient and implements the 'ChannelConsumer' interface to receive the events

Version:
$Revision: 1.1 $
Author:
Brian Weaver, Sowmya Kumaraswamy, OpenNMS.org
See Also:
Serialized Form

Field Summary
private  com.sun.media.jsdt.Channel m_channel
          The JSDT channel on which eventd is listening for messages
private  boolean m_paused
          Flag indicating that operation is to be paused For now events received are simply discarded during pause
private  PCQueue m_readerQ
          queue to which the incoming event stream is to be added
private static int numEventsRcvd
           
 
Constructor Summary
JSDTHandler(PCQueue readerQ)
          Creates a JSDTHandler for eventd
 
Method Summary
 void dataReceived(com.sun.media.jsdt.Data data)
          If operation is not paused, add the incoming event to the 'listenerQ' as an input stream.
private  void jsdtConnect()
          Connect to the eventd JSDT channel
 void pauseOperation()
          Pause the operation - ignore the received messages?
 void resumeOperation()
          Resume the paused operation
 void shutdown()
          Removes itself as a consumer for the JSDT session and closes the session
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

m_readerQ

private PCQueue m_readerQ
queue to which the incoming event stream is to be added

m_channel

private com.sun.media.jsdt.Channel m_channel
The JSDT channel on which eventd is listening for messages

m_paused

private boolean m_paused
Flag indicating that operation is to be paused For now events received are simply discarded during pause

numEventsRcvd

private static int numEventsRcvd
Constructor Detail

JSDTHandler

public JSDTHandler(PCQueue readerQ)
Creates a JSDTHandler for eventd
Parameters:
readerQ - The where EventsReader objects are placed.
Throws:
java.lang.RunTimeException - Thrown if connection to JSDT fails
Method Detail

jsdtConnect

private void jsdtConnect()
                  throws com.sun.media.jsdt.JSDTException
Connect to the eventd JSDT channel
Throws:
InterruptedException - Thrown if the running thread is interrupted by another thread.

pauseOperation

public void pauseOperation()
Pause the operation - ignore the received messages?

resumeOperation

public void resumeOperation()
Resume the paused operation

shutdown

public void shutdown()

Removes itself as a consumer for the JSDT session and closes the session


dataReceived

public void dataReceived(com.sun.media.jsdt.Data data)
If operation is not paused, add the incoming event to the 'listenerQ' as an input stream. Also get the EventListener to check if the the thread pool size needs to be adjusted
Specified by:
dataReceived in interface com.sun.media.jsdt.ChannelConsumer
Parameters:
data - received JSDT data