|
Sea 0.4.0 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object gov.lbl.dsd.sea.Stage
A stage has an input queue into which another stage puts events; A stage has one or more threads, which take events from the input queue and hand them to the stage's event handler which processes the events in a non-blocking asynchronous manner.
Note on exception handling: If a RuntimeException
is raised within
EventHandler.handle(Object)
of this stage's event handler, then this
stage's ExceptionHandler is called, which should handle the exception in an
appropriate application specific manner. If no ExceptionHandler is defined
(because it is null
) the exception is simply rethrown.
Constructor Summary | |
Stage(String stageName,
EventHandler handler,
ExecutorFactory executorFactory,
ExceptionHandler exceptionHandler)
Creates a new stage with the given name, event handler, executor factory and exceptionHandler. |
Method Summary | |
void |
enqueue(Object event)
Enqueues the given event onto this stage. |
void |
enqueue(Object event,
Date date)
Schedules the given event to be enqueued onto this stage at the given (future) time. |
String |
getName()
Returns the name of this stage. |
Stage |
start()
Initializes the stage and its event handler; Must be called before enqueuing events (otherwise enqueues are ignored); This method can be called at any time but only has an effect only if the stage is stopped. |
void |
stop()
Cleans up this stage and its event handler, as well as related threads; Once a stage has been destroyed it can be initialized again by using start; This method can be called at any time but only has an effect if the stage is started. |
String |
toString()
Returns a string representation of the receiver. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public Stage(String stageName, EventHandler handler, ExecutorFactory executorFactory, ExceptionHandler exceptionHandler)
Method Detail |
public String getName()
public String toString()
public Stage start()
this
(for convenient call chaining only)public void stop()
public void enqueue(Object event)
public void enqueue(Object event, Date date)
|
Sea 0.4.0 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |