its.backbone.frame
Class ItsFrameReceiver

java.lang.Object
  extended byits.backbone.frame.ItsFrameReceiver
All Implemented Interfaces:
java.lang.Runnable
Direct Known Subclasses:
ItsFrameRedistributor, SddReceiver, SddTranslator

public class ItsFrameReceiver
extends java.lang.Object
implements java.lang.Runnable

Provides an incoming stream of ITS Frames from the network to an application-specific subclass. The frames are queued internally, and a separate thread handles the notification process, removing frames from the queue only after the notification has completed. So lengthy processing of the frames by a subclass will not prevent all the frames from eventually arriving in order.


Field Summary
 boolean ignoreStreamTimeout
          Allows override of the timeout value that may be contained in an SDD stream.
 
Constructor Summary
ItsFrameReceiver(java.lang.String serverName, int serverPort)
          Constructs an ItsFrameReceiver that listens to the given server.
ItsFrameReceiver(java.lang.String serverName, int serverPort, boolean autoStart)
          Deprecated. As of SDD 2.2.0, it's always necessary to explicitly start the receiver by calling start(), so the autoStart parameter is irrelevant.
 
Method Summary
 void frameReceived(ItsFrame f)
          Subclasses can override this method to receive the incoming ITS Frames.
 FrameQueue getFrameQueue()
          Provides access to the internal FrameQueue object
 InputBuffer getInputBuffer()
          Provides access to the internal InputBuffer object
 void run()
          Main loop for the ItsFrameReceiver thread.
 void start()
          Starts a new connection to the data stream.
 void start(java.lang.ThreadGroup tg)
           
 void stop()
          Terminates the connection to the data stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ignoreStreamTimeout

public boolean ignoreStreamTimeout
Allows override of the timeout value that may be contained in an SDD stream. If it is necessary to call ClientConnection.setTimeout, set this to true to prevent it from being changed again.

Constructor Detail

ItsFrameReceiver

public ItsFrameReceiver(java.lang.String serverName,
                        int serverPort)
                 throws java.io.IOException
Constructs an ItsFrameReceiver that listens to the given server.

Throws:
java.io.IOException - if a connection to the given server is impossible

ItsFrameReceiver

public ItsFrameReceiver(java.lang.String serverName,
                        int serverPort,
                        boolean autoStart)
                 throws java.io.IOException
Deprecated. As of SDD 2.2.0, it's always necessary to explicitly start the receiver by calling start(), so the autoStart parameter is irrelevant.

Constructs an ItsFrameReceiver that listens to the given server.

Parameters:
autoStart - if true, the start() method is called automatically.
Throws:
java.io.IOException - if a connection to the given server is impossible
Method Detail

start

public void start()
           throws java.io.IOException
Starts a new connection to the data stream. This method can be called automatically by the constructor, but also can be used to re-start the receiver after calling stop().

Throws:
java.io.IOException - if a connection to the given server is impossible

start

public void start(java.lang.ThreadGroup tg)
           throws java.io.IOException
Throws:
java.io.IOException

stop

public void stop()
Terminates the connection to the data stream. Can be used if an application needs to pause for a while without processing incoming data.


run

public void run()
Main loop for the ItsFrameReceiver thread. Reads frames from the FrameQueue and passes them to the frameReceived method. Only when the frameReceived method returns is the next frame taken from the queue.

Specified by:
run in interface java.lang.Runnable

frameReceived

public void frameReceived(ItsFrame f)
Subclasses can override this method to receive the incoming ITS Frames. The subclass must be careful to return from this method in a reasonable amount of time relative to the incoming data rate.


getInputBuffer

public InputBuffer getInputBuffer()
Provides access to the internal InputBuffer object


getFrameQueue

public FrameQueue getFrameQueue()
Provides access to the internal FrameQueue object