|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Object
|
+--org.exolab.core.service.Service
|
+--org.exolab.core.service.BasicService
|
+--org.exolab.jms.events.BasicEventManager
The EventManager manages Event objects. It has methods to
register and unregister events. It also extends Runnable interface
which defines the thread responsible for dispatching events.
An event is defined to occur at sometime in the future, as specified either
by an absolute time through registerEvent(org.exolab.jms.events.Event, long) or as relative time
through registerEventRelative(org.exolab.jms.events.Event, long). An event must have an associated
event type and may have an attached Serializable,
which is used when the EventManager makes a callback to the registered
handler when the event fires.
The register methids will return an event identifier which can subsequently
be used to unregister the event through the unregisterEvent(java.lang.String) event.
This is the only means of unregister an event.
If the Event object is incorrectly specified then the
IllegalEventDefinedException exception is raised.
When an event fires the EventManager is responsible for ensuring
that the event handler is notified. If the event handler has since been
removed then the EventManager must gracefully abort the delivery and
continue processing the next event.
Objects of type Event need to survive subsequent
EventManager restarts, as such they must be persisted, which
implies that the EventHandler needs to also be persisted. The
ability to store the EventHandler as a HandleIfc object
which can later be resolved to an object will be required.
| Field Summary | |
static int |
MAX_THREADS
|
static java.lang.String |
NAME
|
| Constructor Summary | |
protected |
BasicEventManager()
|
| Method Summary | |
static EventManager |
instance()
Return the singleton instance of the EventManager |
java.lang.String |
registerEvent(Event event,
long absolute)
Register an event to be fired once and only once at the specified abolsute time. |
java.lang.String |
registerEventRelative(Event event,
long relative)
Register an event to be fired once and only once at a time relative to now. |
void |
run()
|
void |
start()
|
void |
unregisterEvent(java.lang.String id)
Unregister the event specified by the event identifier. |
| Methods inherited from class org.exolab.core.service.BasicService |
stop, toString |
| Methods inherited from class org.exolab.core.service.Service |
getName, getState, restart, setState |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.exolab.core.service.Serviceable |
getName, getState, restart, stop |
| Field Detail |
public static final transient java.lang.String NAME
public static final transient int MAX_THREADS
| Constructor Detail |
protected BasicEventManager()
| Method Detail |
public static EventManager instance()
public java.lang.String registerEvent(Event event,
long absolute)
throws IllegalEventDefinedException
If the specified event is ill-defined then the IllegalEventDefined- Exception exception is thrown.
Similarly, if the abolsute time has already passed then the exception IllegalEventDefinedException is raised.
The method returns an unique event identifier, which can subsequently be used to deregister the event.
registerEvent in interface EventManagerevent - information about the eventabolsute - the abolsute time, in ms, that the event
must fireIllegalEventDefinedException -
public java.lang.String registerEventRelative(Event event,
long relative)
throws IllegalEventDefinedException
If the specified event is ill-defined then the IllegalEventDefined- Exception exception is thrown.
The method returns an unique event identifier, which can subsequently be used to deregister the event.
registerEventRelative in interface EventManagerevent - information about the eventrelative - the relative time in ms
(currently no reference to locale).IllegalEventDefinedException - public void unregisterEvent(java.lang.String id)
unregisterEvent in interface EventManagerString - unique event identifier.public void run()
run in class org.exolab.core.service.BasicService
public void start()
throws org.exolab.core.service.ServiceException
start in interface org.exolab.core.service.Serviceablestart in class org.exolab.core.service.BasicService
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||