Class TaskRecvWorker

java.lang.Object
  extended by TaskRecvWorker
All Implemented Interfaces:
EventHandlerIF

public class TaskRecvWorker
extends java.lang.Object
implements EventHandlerIF

This event handmler listens for connections on the TCP port PORT and accepts packets of size TASK_SIZE. For each packet it delivers a BufferElement to the next handler on the chain, specified by the "next_handler" argument.


Field Summary
private  SinkIF completionWorker
           
private  int cur_offset
           
private  byte[] cur_task
           
private static boolean DEBUG
           
private static boolean DISPATCH_SPIN
           
private  ATcpConnection incomingConnection
           
private  SinkIF mySink
           
private  SinkIF nextWorker
           
private  int PORT
           
private  ATcpServerSocket servsock
           
private  int TASK_SIZE
           
 
Constructor Summary
TaskRecvWorker()
           
 
Method Summary
 void destroy()
          Called when an event handler is destroyed.
 void handleEvent(QueueElementIF item)
          Handle the event corresponding to the given QueueElementIF.
 void handleEvents(QueueElementIF[] items)
          Handle the events corresponding to the given QueueElementIF array.
 void init(ConfigDataIF config)
          Called when an event handler is initialized.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEBUG

private static final boolean DEBUG
See Also:
Constant Field Values

DISPATCH_SPIN

private static final boolean DISPATCH_SPIN
See Also:
Constant Field Values

mySink

private SinkIF mySink

nextWorker

private SinkIF nextWorker

completionWorker

private SinkIF completionWorker

incomingConnection

private ATcpConnection incomingConnection

servsock

private ATcpServerSocket servsock

PORT

private int PORT

TASK_SIZE

private int TASK_SIZE

cur_task

private byte[] cur_task

cur_offset

private int cur_offset
Constructor Detail

TaskRecvWorker

public TaskRecvWorker()
Method Detail

init

public void init(ConfigDataIF config)
          throws java.lang.Exception
Description copied from interface: EventHandlerIF
Called when an event handler is initialized. This method should perform any initialization operations as required by the application.

Specified by:
init in interface EventHandlerIF
Parameters:
config - The set of configuration parameters for the stage.
Throws:
java.lang.Exception - The EventHandler can indicate an error to the runtime during initialization by throwing an Exception.

destroy

public void destroy()
Description copied from interface: EventHandlerIF
Called when an event handler is destroyed. This method should perform any cleanup or shutdown operations as required by the application before the event handler is removed from the system.

Specified by:
destroy in interface EventHandlerIF

handleEvent

public void handleEvent(QueueElementIF item)
Description copied from interface: EventHandlerIF
Handle the event corresponding to the given QueueElementIF. This method is invoked by the system when a single event is pending for the event handler.

Specified by:
handleEvent in interface EventHandlerIF

handleEvents

public void handleEvents(QueueElementIF[] items)
Description copied from interface: EventHandlerIF
Handle the events corresponding to the given QueueElementIF array. This method is invoked when multiple events are pending for the event handler. The application may reorder, filter, or drop these events if it wishes to do so.

Specified by:
handleEvents in interface EventHandlerIF