E
- the element typeO
- the generic typeMATCH
- the generic typeMETA
- the generic typeH
- the generic typeorg.refcodes.component.HandleLookup<H,O>
, DispatchStrategyAccessor
, GenericBusObservable<E,O,MATCH,H>
, GenericBusPublisher<E>
, GenericEventBus<E,O,MATCH,META,H>
, org.refcodes.matcher.Matcher<E>
, org.refcodes.observer.EventMatcher<E>
, org.refcodes.observer.Publisher<E>
EventBusImpl
public abstract class AbstractEventBus<E extends org.refcodes.observer.GenericEvent<?>,O extends org.refcodes.observer.Observer<E>,MATCH extends org.refcodes.observer.EventMatcher<E>,META extends org.refcodes.observer.EventMetaData,H> extends Object implements GenericEventBus<E,O,MATCH,META,H>
DispatchStrategyAccessor.DispatchStrategyMutator, DispatchStrategyAccessor.DispatchStrategyProperty
Constructor | Description |
---|---|
AbstractEventBus(int aCorePoolSize,
org.refcodes.component.HandleGenerator<H> aHandleGenerator) |
Constructs the
AbstractEventBus with the DispatchStrategy
being DispatchStrategy.CASCADE when publishing events and the
given handle generator. |
AbstractEventBus(org.refcodes.component.HandleGenerator<H> aHandleGenerator) |
Constructs the
AbstractEventBus with the DispatchStrategy
being DispatchStrategy.CASCADE when publishing events and the
given handle generator. |
AbstractEventBus(org.refcodes.component.HandleGenerator<H> aHandleGenerator,
ExecutorService aExecutorService) |
Constructs the
AbstractEventBus with the DispatchStrategy
being DispatchStrategy.CASCADE when publishing events and the
given handle generator. |
AbstractEventBus(DispatchStrategy aDispatchStrategy,
int aCorePoolSize,
org.refcodes.component.HandleGenerator<H> aHandleGenerator) |
Constructs the
AbstractEventBus with the given
DispatchStrategy when publishing events and the given handle
generator. |
AbstractEventBus(DispatchStrategy aDispatchStrategy,
org.refcodes.component.HandleGenerator<H> aHandleGenerator) |
Constructs the
AbstractEventBus with the given
DispatchStrategy when publishing events and the given handle
generator. |
AbstractEventBus(DispatchStrategy aDispatchStrategy,
org.refcodes.component.HandleGenerator<H> aHandleGenerator,
ExecutorService aExecutorService) |
Constructs the
AbstractEventBus with the given
DispatchStrategy when publishing events and the given handle
generator. |
Modifier and Type | Method | Description |
---|---|---|
protected void |
cascadeDispatch(E aEvent,
Object aMonitor) |
Hook implementing the cascaded dispatch method as of
DispatchStrategy.CASCADE |
DispatchStrategy |
getDispatchStrategy() |
Retrieves the
DispatchStrategy property from the property. |
boolean |
hasHandle(H aHandle) |
|
boolean |
isMatching(E aEvent) |
|
O |
lookupHandle(H aHandle) |
|
protected void |
parallelDispatch(E aEvent) |
Hook implementing the parallel dispatch method as of
DispatchStrategy.PARALLEL |
void |
publishEvent(E aEvent,
DispatchStrategy aDispatchStrategy) |
Publishes an event using the given
DispatchStrategy . |
O |
removeHandle(H aHandle) |
|
protected void |
sequentialDispatch(E aEvent) |
Hook implementing the sequential dispatch method as of
DispatchStrategy.SEQUENTIAL |
H |
subscribe(MATCH aEventMatcher,
O aObserver) |
Subscribes a listener to the event bus.
|
void |
unsubscribeAll(O aObserver) |
Unsubscribes all registrations to a specific listener, even if that
listener is involved in several subscriptions.
|
subscribe, subscribe
onAction, onAction, onActions, onActions, onAlias, onAlias, onCatchAll, onChannel, onChannel, onEvent, onEvent, onEvent, onEvent, onEvent, onEvent, onEvent, onEvent, onEvent, onEvent, onEvent, onEvent, onEvent, onEvent, onGroup, onGroup, onType, onUniversalId, onUniversalId, publishEvent, publishEvent, publishEvent, publishEvent, publishEvent, publishEvent, publishEvent, publishEvent, publishEvent, publishEvent, publishEvent, publishEvent, publishEvent, publishEvent, publishEvent, publishEvent, publishEvent, publishEvent, publishEvent, publishEvent
public AbstractEventBus(int aCorePoolSize, org.refcodes.component.HandleGenerator<H> aHandleGenerator)
AbstractEventBus
with the DispatchStrategy
being DispatchStrategy.CASCADE
when publishing events and the
given handle generator.aCorePoolSize
- The number of threads to keep in the pool, even if
they are idle.aHandleGenerator
- The handle generator to be used.public AbstractEventBus(DispatchStrategy aDispatchStrategy, int aCorePoolSize, org.refcodes.component.HandleGenerator<H> aHandleGenerator)
AbstractEventBus
with the given
DispatchStrategy
when publishing events and the given handle
generator.aDispatchStrategy
- THe DispatchStrategy
to be used when
publishing events.aCorePoolSize
- The number of threads to keep in the pool, even if
they are idle.aHandleGenerator
- The handle generator to be used.public AbstractEventBus(org.refcodes.component.HandleGenerator<H> aHandleGenerator)
AbstractEventBus
with the DispatchStrategy
being DispatchStrategy.CASCADE
when publishing events and the
given handle generator.aHandleGenerator
- The handle generator to be used.public AbstractEventBus(org.refcodes.component.HandleGenerator<H> aHandleGenerator, ExecutorService aExecutorService)
AbstractEventBus
with the DispatchStrategy
being DispatchStrategy.CASCADE
when publishing events and the
given handle generator.aHandleGenerator
- The handle generator to be used.aExecutorService
- THe ExecutorService
to be used when
creating threads.public AbstractEventBus(DispatchStrategy aDispatchStrategy, org.refcodes.component.HandleGenerator<H> aHandleGenerator)
AbstractEventBus
with the given
DispatchStrategy
when publishing events and the given handle
generator.aDispatchStrategy
- THe DispatchStrategy
to be used when
publishing events.aHandleGenerator
- The handle generator to be used.public AbstractEventBus(DispatchStrategy aDispatchStrategy, org.refcodes.component.HandleGenerator<H> aHandleGenerator, ExecutorService aExecutorService)
AbstractEventBus
with the given
DispatchStrategy
when publishing events and the given handle
generator.aDispatchStrategy
- THe DispatchStrategy
to be used when
publishing events.aHandleGenerator
- The handle generator to be used.aExecutorService
- THe ExecutorService
to be used when
creating threads.public boolean isMatching(E aEvent)
public H subscribe(MATCH aEventMatcher, O aObserver)
subscribe
in interface GenericBusObservable<E extends org.refcodes.observer.GenericEvent<?>,O extends org.refcodes.observer.Observer<E>,MATCH extends org.refcodes.observer.EventMatcher<E>,META extends org.refcodes.observer.EventMetaData>
aEventMatcher
- The EventMatcher
to guard the
Observer
.aObserver
- The Observer
to subscribe.public void unsubscribeAll(O aObserver)
unsubscribeAll
in interface GenericBusObservable<E extends org.refcodes.observer.GenericEvent<?>,O extends org.refcodes.observer.Observer<E>,MATCH extends org.refcodes.observer.EventMatcher<E>,META extends org.refcodes.observer.EventMetaData>
aObserver
- the observerpublic boolean hasHandle(H aHandle)
public O lookupHandle(H aHandle) throws org.refcodes.component.UnknownHandleRuntimeException
public O removeHandle(H aHandle) throws org.refcodes.component.UnknownHandleRuntimeException
public DispatchStrategy getDispatchStrategy()
DispatchStrategy
property from the property.
Determines in which DispatchStrategy
status a component is in.getDispatchStrategy
in interface DispatchStrategyAccessor
DispatchStrategy
property stored by the
property.public void publishEvent(E aEvent, DispatchStrategy aDispatchStrategy)
DispatchStrategy
.publishEvent
in interface GenericEventBus<E extends org.refcodes.observer.GenericEvent<?>,O extends org.refcodes.observer.Observer<E>,MATCH extends org.refcodes.observer.EventMatcher<E>,META extends org.refcodes.observer.EventMetaData,H>
aEvent
- aEvent The event to be published.aDispatchStrategy
- The DispatchStrategy
to be used when
publishing the event.protected void sequentialDispatch(E aEvent)
DispatchStrategy.SEQUENTIAL
aEvent
- The event to be dispatched sequentially.protected void parallelDispatch(E aEvent)
DispatchStrategy.PARALLEL
aEvent
- The event to be dispatched sequentially.protected void cascadeDispatch(E aEvent, Object aMonitor)
DispatchStrategy.CASCADE
aEvent
- The event to be dispatched cascading.aMonitor
- The monitor used for synchronizing this cascade.Copyright © 2018. All rights reserved.