|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.keridwen.core.messaging.internal.CoreEventDispatcher
public final class CoreEventDispatcher
This class provides a default implementation of an EventDispatcher
.
Method Summary | ||
---|---|---|
void |
clean()
Removes all registered BundleController s and EventDispatcher s. |
|
static EventDispatcher |
getInstance()
Returns the singleton instance of the event dispatcher. |
|
boolean |
isEventRegistered(Event<?,?> event)
|
|
void |
registerBundle(BundleController controller)
Registers the given BundleController to be called on Event dispatch. |
|
void |
registerEventDispatcher(EventDispatcher dispatcher)
Registers the given EventDispatcher to be called on Event dispatch. |
|
void |
terminate()
Terminates all threads running in the registred controllers. |
|
|
triggerChangeEvent(Event<ReturnType,?> event,
Condition condition)
Triggers the given Event that will trigger the command execution as soon as the change
Condition becomes true. |
|
|
triggerEvent(Event<ReturnType,?> event)
Triggers the given Event asynchronously. |
|
|
triggerEvent(Event<ReturnType,?> event,
int nbThreads)
|
|
|
triggerTimeEvent(Event<ReturnType,?> event,
long delay,
TimeUnit unit)
Triggers the given Event after the given delay. |
|
|
triggerTimeEventAtFixedRate(Event<ReturnType,?> event,
long initialDelay,
long period,
TimeUnit unit)
Triggers the given Event after the given delay and at a given period. |
|
|
triggerTimeEventWithFixedDelay(Event<ReturnType,?> event,
long initialDelay,
long delay,
TimeUnit unit)
Triggers the given Event after the given delay with the given delay between two executions. |
|
void |
unregisterBundle(BundleController controller)
Unregisters the given BundleController . |
|
void |
unregisterEventDispatcher(EventDispatcher dispatcher)
Unregisters the given EventDispatcher . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static EventDispatcher getInstance()
public void registerEventDispatcher(EventDispatcher dispatcher)
EventDispatcher
EventDispatcher
to be called on Event
dispatch.
registerEventDispatcher
in interface EventDispatcher
dispatcher
- the EventDispatcher
to registerpublic void unregisterEventDispatcher(EventDispatcher dispatcher)
EventDispatcher
EventDispatcher
.
unregisterEventDispatcher
in interface EventDispatcher
dispatcher
- the EventDispatcher
to unregisterpublic void registerBundle(BundleController controller)
EventDispatcher
BundleController
to be called on Event
dispatch.
registerBundle
in interface EventDispatcher
controller
- the BundleController
to registerpublic void unregisterBundle(BundleController controller)
EventDispatcher
BundleController
.
unregisterBundle
in interface EventDispatcher
controller
- the BundleController
to unregisterpublic void clean()
EventDispatcher
BundleController
s and EventDispatcher
s.
clean
in interface EventDispatcher
public <ReturnType> Supervisor<ReturnType> triggerEvent(Event<ReturnType,?> event)
EventDispatcher
Event
asynchronously.
triggerEvent
in interface EventDispatcher
ReturnType
- type of the data returned by the command triggered by the event.event
- the event to trigger
public <ReturnType> Supervisor<ReturnType> triggerEvent(Event<ReturnType,?> event, int nbThreads)
triggerEvent
in interface EventDispatcher
public <ReturnType> Supervisor<ReturnType> triggerChangeEvent(Event<ReturnType,?> event, Condition condition)
EventDispatcher
Event
that will trigger the command execution as soon as the change
Condition
becomes true.
triggerChangeEvent
in interface EventDispatcher
ReturnType
- type of the data returned by the command triggered by the event.event
- the event to triggercondition
- the Condition
to watch
public <ReturnType> Supervisor<ReturnType> triggerTimeEvent(Event<ReturnType,?> event, long delay, TimeUnit unit)
EventDispatcher
Event
after the given delay.
triggerTimeEvent
in interface EventDispatcher
ReturnType
- type of the data returned by the command triggered by the event.event
- the event to triggerdelay
- the time from now to delay executionunit
- the time unit of the delay parameter
public <ReturnType> Supervisor<ReturnType> triggerTimeEventWithFixedDelay(Event<ReturnType,?> event, long initialDelay, long delay, TimeUnit unit)
EventDispatcher
Event
after the given delay with the given delay between two executions.
triggerTimeEventWithFixedDelay
in interface EventDispatcher
ReturnType
- type of the data returned by the command triggered by the event.event
- the event to triggerinitialDelay
- the time from now to delay the first executiondelay
- the delay between termination of one execution and the commencement of the nextunit
- the time unit of the parameters
public <ReturnType> Supervisor<ReturnType> triggerTimeEventAtFixedRate(Event<ReturnType,?> event, long initialDelay, long period, TimeUnit unit)
EventDispatcher
Event
after the given delay and at a given period.
triggerTimeEventAtFixedRate
in interface EventDispatcher
ReturnType
- type of the data returned by the command triggered by the event.event
- the event to triggerinitialDelay
- the time from now to delay the first executionperiod
- the period between two consecutive executionsunit
- the time unit of the parameters
public void terminate()
EventDispatcher
terminate
in interface EventDispatcher
public boolean isEventRegistered(Event<?,?> event)
isEventRegistered
in interface EventDispatcher
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |