seda.sandStorm.api
Interface EventHandlerIF

All Known Implementing Classes:
AFileTPEventHandler, aSocketEventHandler, ClientStage, ClientStageMulticlass, CompletionWorker, CopyFile, DevNullHandler, DevNullHandler, GenericHandler, GenericHandler, genericServer, genericUdpService, GenericWorker, GnutellaCatcher, GnutellaServer, httpServer, ListenEventHandler, ProcessStage, ProcessStage, ProcessStageComplex, ProcessStageConstCPU, ProcessStageConstCPU, ProcessStageExpCPU, ProcessStageExpCPU, ProcessStageExpCPUSched, ProcessStageFileIO, ProcessStageSleep, ReadEventHandler, RecvStage, RecvStage, SimpleGnutellaServer, TaskRecvWorker, TestHandler, TestServer, TimerHandler, TimerHandler, WriteEventHandler

public interface EventHandlerIF

An EventHandlerIF represents an event handler - the basic unit of computation in SandStorm. This is the basic interface which all application modules implement.


Method Summary
 void destroy()
          Called when an event handler is destroyed.
 void handleEvent(QueueElementIF elem)
          Handle the event corresponding to the given QueueElementIF.
 void handleEvents(QueueElementIF[] elemarr)
          Handle the events corresponding to the given QueueElementIF array.
 void init(ConfigDataIF config)
          Called when an event handler is initialized.
 

Method Detail

handleEvent

void handleEvent(QueueElementIF elem)
                 throws EventHandlerException
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.

Throws:
EventHandlerException - The application may throw an exception to indicate an error condition during event processing.

handleEvents

void handleEvents(QueueElementIF[] elemarr)
                  throws EventHandlerException
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.

Throws:
EventHandlerException - The application may throw an exception to indicate an error condition during event processing.

init

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

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

void destroy()
             throws java.lang.Exception
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.

Throws:
java.lang.Exception - The EventHandler can indicate an error to the runtime during shutdown by throwing an Exception.