OpenNMS API 1.2.3

org.opennms.netmgt.eventd.adaptors.tcp
Class TcpStreamHandler

java.lang.Object
  extended byorg.opennms.netmgt.eventd.adaptors.tcp.TcpStreamHandler
All Implemented Interfaces:
java.lang.Runnable

final class TcpStreamHandler
extends java.lang.Object
implements java.lang.Runnable

Provides the logic and context of execution necessary to actually process a client's event XML document. When a new stream handler is created and assigned to an execution context it will unmarshall the remote document. The events from the remote document are then passed to the registered event handlers. All successfully processed events are acknowledged to the client by the generation of an XML event receipt.

Author:
Brian Weaver , OpenNMS

Field Summary
private  java.net.Socket m_connection
          The socket connection to receive and process events from.
private  java.lang.Thread m_context
          The thread context this runnable is executing in
private  java.util.List m_handlers
          The registered list of event handlers.
private  Fiber m_parent
          The parent of this stream handler.
private  int m_recsPerConn
          The number of records per connection
private  boolean m_stop
          Set to stop the thread context.
 
Constructor Summary
(package private) TcpStreamHandler(Fiber parent, java.net.Socket sock, java.util.List handlers, int number)
          Constructs a new TCP/IP stream handler to process the remote document.
 
Method Summary
(package private)  boolean isAlive()
          Returns true if the context is alive.
 void run()
          The main execution context for processing a remote XML document.
(package private)  void stop()
          Stops and joins the context.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_handlers

private java.util.List m_handlers
The registered list of event handlers. Each incomming event will be passed to all event handlers. The event handlers MUST NOT modify the passed event.


m_stop

private volatile boolean m_stop
Set to stop the thread context.


m_parent

private Fiber m_parent
The parent of this stream handler.


m_connection

private java.net.Socket m_connection
The socket connection to receive and process events from. The successfully processed events will be acknowledged in an event-recipt document.


m_context

private java.lang.Thread m_context
The thread context this runnable is executing in


m_recsPerConn

private int m_recsPerConn
The number of records per connection

Constructor Detail

TcpStreamHandler

TcpStreamHandler(Fiber parent,
                 java.net.Socket sock,
                 java.util.List handlers,
                 int number)
Constructs a new TCP/IP stream handler to process the remote document.

Parameters:
parent - The parent fiber
sock - The socket connection
handlers - The list of event handlers.
number - The number of event records to process
Method Detail

isAlive

boolean isAlive()
Returns true if the context is alive.


stop

void stop()
    throws java.lang.InterruptedException
Stops and joins the context.

Throws:
java.lang.InterruptedException

run

public void run()
The main execution context for processing a remote XML document. Once the document is processed and an event receipt is returned to the client the thread will exit.

Specified by:
run in interface java.lang.Runnable

OpenNMS API 1.2.3

Generated by eevans on May 29 2005 2015.