its.backbone.frame
Class ItsFrameRedistributor
java.lang.Object
its.backbone.frame.ItsFrameReceiver
its.backbone.frame.ItsFrameRedistributor
- All Implemented Interfaces:
- java.lang.Runnable
- Direct Known Subclasses:
- Redistributor
- public class ItsFrameRedistributor
- extends ItsFrameReceiver
Base class for components that are both receivers and transmitters
of ITS frames. One use of such a component is to scale the data
stream across machines to meet increased demand. Another possibility
is that the Redistributor component changes the data stream in some way,
providing the result of its calculations to listeners downstream.
|
Constructor Summary |
ItsFrameRedistributor(java.lang.String sourceServer,
int sourcePort,
int requestPort)
Creates an ItsFrameRedistributor. |
ItsFrameRedistributor(java.lang.String sourceServer,
int sourcePort,
int requestPort,
boolean autoStart)
Creates an ItsFrameRedistributor. |
| Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ItsFrameRedistributor
public ItsFrameRedistributor(java.lang.String sourceServer,
int sourcePort,
int requestPort,
boolean autoStart)
throws java.io.IOException
- Creates an ItsFrameRedistributor.
- Parameters:
sourceServer - the name of the upstream serversourcePort - the port on the upstream serverrequestPort - the port where the object will listen
for connection requests from downstream componentsautoStart - whether the receiver auto-connects to its upstream server
- Throws:
java.io.IOException - indicates a problem creating a serverSocket on requestPort
java.net.UnknownHostException - indicates a problem connecting to the server
ItsFrameRedistributor
public ItsFrameRedistributor(java.lang.String sourceServer,
int sourcePort,
int requestPort)
throws java.io.IOException
- Creates an ItsFrameRedistributor. Autostarts the receiver
- Parameters:
sourceServer - the name of the upstream serversourcePort - the port on the upstream serverrequestPort - the port where the object will listen
for connection requests from downstream components
- Throws:
java.io.IOException - indicates a problem creating a serverSocket on requestPort
java.net.UnknownHostException - indicates a problem connecting to the server
frameReceived
public void frameReceived(ItsFrame frame)
- Description copied from class:
ItsFrameReceiver
- 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.
- Overrides:
frameReceived in class ItsFrameReceiver
transform
protected ItsFrame transform(ItsFrame frame)
throws DenyFrameException
- This method can be overridden by subclasses to
transform or filter frames in the data stream.
The default implementation here simply returns
the same frame that was passed in.
- Parameters:
frame - A frame received from the data stream
- Returns:
- the transformed frame
- Throws:
DenyFrameException - prevents this frame from being redistributed
transmitFrame
protected void transmitFrame(ItsFrame f)
finalize
public void finalize()