OpenNMS API 1.2.9

## org.opennms.netmgt.eventd.adaptors.tcp
Class TcpRecordHandler

    java.lang.Object
      org.opennms.netmgt.eventd.adaptors.tcp.TcpRecordHandler

All Implemented Interfaces:
  java.lang.Runnable

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

This class is used to do the initial read of data from the input stream and break it up into records. Each record is written to a piped writer. This means that the reader never gets too far ahead of the parse. It means more threads for less memory useage. As always there is a tradeoff

Author:
  Brian Weaver , OpenNMS

Nested Class Summary
`private static class` `TcpRecordHandler.StateManager` This class is use to model the set of states, the attached TcpRecordHandler, and the transition actions.

Field Summary
`private java.net.Socket` `m_connection` The input stream socket
`private java.lang.Thread` `m_context` The thread context running this runnable
`private java.io.OutputStream` `m_out` The current pipe.
`private boolean` `m_stop` When set the runnable should exit as fast as possible.
`private TcpRecordHandler.StateManager[]` `m_tokenizer` The set of state managers
`private java.util.List` `m_xchange` The list of piped output streams and execptions.

Constructor Summary
`(package private)` `TcpRecordHandler(java.net.Socket s, java.util.List xchange)` Constructs a new record handler.

Method Summary
`private void` `closeStream()` Closes the current stream if any
`private void` `forward(char ch)` forwards the characters to the attached pipe.
`(package private) boolean` `isAlive()` Returns true if the context is alive
`private void` `newStream()` Allocates a new stream
`void` `run()` The execution context.
`(package private) void` `stop()` Stops and joins the current context.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### m_stop

    private volatile boolean m_stop

  When set the runnable should exit as fast as possible.

### m_context

    private java.lang.Thread m_context

  The thread context running this runnable

### m_xchange

    private java.util.List m_xchange

  The list of piped output streams and execptions.

### m_connection

    private java.net.Socket m_connection

  The input stream socket

### m_out

    private java.io.OutputStream m_out

  The current pipe.

### m_tokenizer

    private TcpRecordHandler.StateManager[] m_tokenizer

  The set of state managers

Constructor Detail

### TcpRecordHandler

    TcpRecordHandler(java.net.Socket s,
                     java.util.List xchange)

  Constructs a new record handler.

Parameters:
  `s` - The socket to read from
  `xchange` - The io exchange

Method Detail

### closeStream

    private void closeStream()
                      throws java.io.IOException

  Closes the current stream if any

  Throws:
    `java.io.IOException`

### newStream

    private void newStream()
                    throws java.io.IOException

  Allocates a new stream

  Throws:
    `java.io.IOException`

### forward

    private void forward(char ch)
                  throws java.io.IOException

  forwards the characters to the attached pipe.

  Throws:
    `java.io.IOException`

### isAlive

    boolean isAlive()

  Returns true if the context is alive

### stop

    void stop()
        throws java.lang.InterruptedException

  Stops and joins the current context.

  Throws:
    `java.lang.InterruptedException`

### run

    public void run()

  The execution context.

  Specified by:
    `run` in interface `java.lang.Runnable`

OpenNMS API 1.2.9

Generated by ranger on May 19 2007 2335.