org.ourgrid.peer.manager
Class PeerEventEngine

java.lang.Object
  extended by org.ourgrid.peer.manager.PeerEventEngine
All Implemented Interfaces:
java.io.Serializable, java.lang.Runnable, EBSyncShutdownable, EventEngine<ActionEvent>, ShutdownEventEngine

public class PeerEventEngine
extends java.lang.Object
implements ShutdownEventEngine, java.io.Serializable

This class is responsible for receiving events that come probably from a EBPeerManagerFacade and process them.

See Also:
EBPeerFacade, Serialized Form

Constructor Summary
PeerEventEngine(java.lang.String threadName)
          Creates a new PeerEventEngine.
 
Method Summary
 boolean isAlive()
          Checks if the EBSyncShutdownable is alive.
 void putEvent(ActionEvent event)
          Inserts a Event- to be processed - into a internal EventQueue.
 void run()
          Consumes events from internal EventQueue.
 void shutdown(EventQueue<ShutdownResponseEvent> eq)
          Marks this Runnable to be shutdown.
 void startProcessing()
          Begin consuming of events.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PeerEventEngine

public PeerEventEngine(java.lang.String threadName)
Creates a new PeerEventEngine.

Parameters:
threadName - a name for the event processor thread
Method Detail

startProcessing

public void startProcessing()
Begin consuming of events. Consuming means remove events from the queue and process (call the process() method) them.

Specified by:
startProcessing in interface EventEngine<ActionEvent>

putEvent

public void putEvent(ActionEvent event)
Inserts a Event- to be processed - into a internal EventQueue.

Specified by:
putEvent in interface EventEngine<ActionEvent>
Parameters:
event - A Event to be processed.

run

public void run()
Consumes events from internal EventQueue. In other words, it removes events from the queue and process (call the process() method) them.

Specified by:
run in interface java.lang.Runnable

shutdown

public void shutdown(EventQueue<ShutdownResponseEvent> eq)
Marks this Runnable to be shutdown. It saves the parameter EventQueue to put a ShutdownNotifyEvent when the shutdown is done.

Specified by:
shutdown in interface EBSyncShutdownable
Parameters:
eq - A EventQueue that receives a ShutdownNotifyEvent when the shutdown is completed.

isAlive

public boolean isAlive()
Description copied from interface: EBSyncShutdownable
Checks if the EBSyncShutdownable is alive.

Specified by:
isAlive in interface EBSyncShutdownable
Returns:
True if it is alive, false otherwise
See Also:
EBSyncShutdownable.isAlive()