Interface LifecycleBus
- All Superinterfaces:
org.refcodes.component.Destroyable
,org.refcodes.component.Destroyable.DestroyAutomaton
,DestroyBus
,org.refcodes.eventbus.DispatchStrategyAccessor
,org.refcodes.eventbus.EventBusObservable<ApplicationBusEvent,
,org.refcodes.observer.Observer<ApplicationBusEvent>, ApplicationBusEventMatcher, String> org.refcodes.eventbus.EventBusPublisher<ApplicationBusEvent>
,org.refcodes.eventbus.EventDispatcher<ApplicationBusEvent,
,org.refcodes.observer.Observer<ApplicationBusEvent>, ApplicationBusEventMatcher, org.refcodes.observer.EventMetaData, String> org.refcodes.component.HandleLookup<String,
,org.refcodes.observer.Observer<ApplicationBusEvent>> org.refcodes.component.Initializable
,org.refcodes.component.Initializable.InitializeAutomaton
,InitializeBus
,org.refcodes.component.InitializedAccessor
,org.refcodes.component.LifecycleComponent
,org.refcodes.component.LifecycleComponent.LifecycleAutomaton
,org.refcodes.component.LifecycleStatusAccessor
,org.refcodes.matcher.Matchable<ApplicationBusEvent>
,org.refcodes.component.Pausable
,org.refcodes.component.Pausable.PauseAutomaton
,PauseBus
,org.refcodes.observer.Publisher<ApplicationBusEvent>
,org.refcodes.component.Resumable
,org.refcodes.component.Resumable.ResumeAutomaton
,ResumeBus
,org.refcodes.component.RunningAccessor
,org.refcodes.component.Startable
,org.refcodes.component.Startable.StartAutomaton
,StartBus
,StopBus
,org.refcodes.component.Stoppable
,org.refcodes.component.Stoppable.StopAutomaton
- All Known Implementing Classes:
ApplicationBus
public interface LifecycleBus
extends InitializeBus, StartBus, PauseBus, ResumeBus, StopBus, DestroyBus, org.refcodes.component.LifecycleComponent.LifecycleAutomaton
The
LifecycleBus
extends the ApplicationBus
with convenience
functionality common to everyday application and service development
regarding dispatching of LifecycleStatus
signals such as
InitializeBusEvent
, StartBusEvent
, PauseBusEvent
,
ResumeBusEvent
, StopBusEvent
or DestroyBusEvent
instances. To ensure controlled LifecycleBusObserver
bootstrapping
(subscribed via onLifecycle(LifecycleBusObserver)
and the like), the
InitializeBusEvent
instances fired upon calls to methods such as
InitializeBus.publishInitialize(String)
(and the like) are (if not stated
otherwise) dispatched with the DispatchStrategy.CASCADE
strategy.
Same applies to service "shutdown" as of PauseBus.publishPause()
,
StopBus.publishStop()
or DestroyBus.publishDestroy()
(and the like) which are
also dispatched by default with the DispatchStrategy.CASCADE
strategy. This means that the observer methods
LifecycleBusObserver.onInitialize(InitializeBusEvent)
,
LifecycleBusObserver.onPause(PauseBusEvent)
,
LifecycleBusObserver.onStop(StopBusEvent)
and
LifecycleBusObserver.onDestroy(DestroyBusEvent)
must exit the
invoking thread as soon as possible so not to block succeeding listener
methods. As initialization is processed in a controlled manner (as mentioned
above), starting or resuming the LifecycleBusObserver
instances is
done with the DispatchStrategy.PARALLEL
as we enter normal operation.
This means that the observer methods
LifecycleBusObserver.onStart(StartBusEvent)
and
LifecycleBusObserver.onResume(ResumeBusEvent)
do not need to exit the
invoking thread as they cannot block succeeding listener methods.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.refcodes.component.Destroyable
org.refcodes.component.Destroyable.DestroyAutomaton
Nested classes/interfaces inherited from interface org.refcodes.eventbus.DispatchStrategyAccessor
org.refcodes.eventbus.DispatchStrategyAccessor.DispatchStrategyMutator, org.refcodes.eventbus.DispatchStrategyAccessor.DispatchStrategyProperty
Nested classes/interfaces inherited from interface org.refcodes.component.Initializable
org.refcodes.component.Initializable.InitializeAutomaton, org.refcodes.component.Initializable.InitializeBuilder<B extends org.refcodes.component.Initializable.InitializeBuilder<B>>, org.refcodes.component.Initializable.UncheckedInitializable
Nested classes/interfaces inherited from interface org.refcodes.component.InitializedAccessor
org.refcodes.component.InitializedAccessor.InitializedMutator, org.refcodes.component.InitializedAccessor.InitializedProperty
Nested classes/interfaces inherited from interface org.refcodes.component.LifecycleComponent
org.refcodes.component.LifecycleComponent.LifecycleAutomaton, org.refcodes.component.LifecycleComponent.UncheckedLifecycleComponent
Nested classes/interfaces inherited from interface org.refcodes.component.LifecycleStatusAccessor
org.refcodes.component.LifecycleStatusAccessor.LifecycleStatusBuilder<B extends org.refcodes.component.LifecycleStatusAccessor.LifecycleStatusBuilder<B>>, org.refcodes.component.LifecycleStatusAccessor.LifecycleStatusMutator, org.refcodes.component.LifecycleStatusAccessor.LifecycleStatusProperty
Nested classes/interfaces inherited from interface org.refcodes.component.Pausable
org.refcodes.component.Pausable.PauseAutomaton, org.refcodes.component.Pausable.PauseBuilder<B extends org.refcodes.component.Pausable.PauseBuilder<B>>, org.refcodes.component.Pausable.UncheckedPausable
Nested classes/interfaces inherited from interface org.refcodes.component.Resumable
org.refcodes.component.Resumable.ResumeAutomaton, org.refcodes.component.Resumable.ResumeBuilder<B extends org.refcodes.component.Resumable.ResumeBuilder<B>>, org.refcodes.component.Resumable.UncheckedResumable
Nested classes/interfaces inherited from interface org.refcodes.component.RunningAccessor
org.refcodes.component.RunningAccessor.RunningMutator, org.refcodes.component.RunningAccessor.RunningProperty
Nested classes/interfaces inherited from interface org.refcodes.component.Startable
org.refcodes.component.Startable.StartAutomaton, org.refcodes.component.Startable.StartBuilder<B extends org.refcodes.component.Startable.StartBuilder<B>>, org.refcodes.component.Startable.UncheckedStartable
Nested classes/interfaces inherited from interface org.refcodes.component.Stoppable
org.refcodes.component.Stoppable.StopAutomaton, org.refcodes.component.Stoppable.StopBuilder<B extends org.refcodes.component.Stoppable.StopBuilder<B>>, org.refcodes.component.Stoppable.UncheckedStoppable
-
Method Summary
Modifier and TypeMethodDescriptiondefault String
onLifecycle
(Class<?> aPublisherType, LifecycleBusObserver aObserver) Subscribes aLifecycleBusObserver
forLifecycleBusEvent
instances with the given attributes to be passed to the accordingLifecycleBusObserver
methods.default String
onLifecycle
(Enum<?> aAction, Class<?> aPublisherType, LifecycleBusObserver aObserver) Subscribes aLifecycleBusObserver
forLifecycleBusEvent
instances with the given attributes to be passed to the accordingLifecycleBusObserver
methods.default String
onLifecycle
(Enum<?> aAction, String aAlias, String aGroup, String aChannel, String aUid, Class<?> aPublisherType, LifecycleBusObserver aObserver) Subscribes aLifecycleBusObserver
forLifecycleBusEvent
instances with the given attributes to be passed to the accordingLifecycleBusObserver
methods.default String
onLifecycle
(Enum<?> aAction, String aChannel, LifecycleBusObserver aObserver) Subscribes aLifecycleBusObserver
forLifecycleBusEvent
instances with the given attributes to be passed to the accordingLifecycleBusObserver
methods.default String
onLifecycle
(Enum<?> aAction, LifecycleBusObserver aObserver) Subscribes aLifecycleBusObserver
forLifecycleBusEvent
instances with the given attributes to be passed to the accordingLifecycleBusObserver
methods.default String
onLifecycle
(String aAlias, String aGroup, String aChannel, String aUid, Class<?> aPublisherType, LifecycleBusObserver aObserver) Subscribes aLifecycleBusObserver
forLifecycleBusEvent
instances with the given attributes to be passed to the accordingLifecycleBusObserver
methods.default String
onLifecycle
(String aChannel, LifecycleBusObserver aObserver) Subscribes aLifecycleBusObserver
forLifecycleBusEvent
instances with the given attributes to be passed to the accordingLifecycleBusObserver
methods.default String
onLifecycle
(LifecycleBusObserver aObserver) Subscribes aLifecycleBusObserver
forLifecycleBusEvent
instances to be passed to the accordingLifecycleBusObserver
methods.Methods inherited from interface org.refcodes.component.Destroyable
destroy
Methods inherited from interface org.refcodes.component.Destroyable.DestroyAutomaton
isDestroyable, isDestroyed
Methods inherited from interface org.refcodes.eventbus.ext.application.DestroyBus
onDestroy, onDestroy, onDestroy, onDestroy, onDestroy, onDestroy, onDestroy, onDestroy, publishDestroy, publishDestroy, publishDestroy, publishDestroy, publishDestroy, publishDestroy, publishDestroy, publishDestroy, publishDestroy, publishDestroy
Methods inherited from interface org.refcodes.eventbus.DispatchStrategyAccessor
getDispatchStrategy
Methods inherited from interface org.refcodes.eventbus.EventBusObservable
subscribe, subscribe, subscribe, unsubscribeAll
Methods inherited from interface org.refcodes.eventbus.EventDispatcher
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, publishEvent, publishEvent
Methods inherited from interface org.refcodes.component.HandleLookup
hasHandle, lookupHandle, removeHandle
Methods inherited from interface org.refcodes.component.Initializable
initialize, initializeUnchecked
Methods inherited from interface org.refcodes.component.Initializable.InitializeAutomaton
isInitalizable
Methods inherited from interface org.refcodes.eventbus.ext.application.InitializeBus
onInitialize, onInitialize, onInitialize, onInitialize, onInitialize, onInitialize, onInitialize, onInitialize, publishInitialize, publishInitialize, publishInitialize, publishInitialize, publishInitialize, publishInitialize, publishInitialize, publishInitialize, publishInitialize, publishInitialize
Methods inherited from interface org.refcodes.component.InitializedAccessor
isInitialized
Methods inherited from interface org.refcodes.component.LifecycleStatusAccessor
getLifecycleStatus
Methods inherited from interface org.refcodes.matcher.Matchable
isMatching
Methods inherited from interface org.refcodes.component.Pausable
pause, pauseUnchecked
Methods inherited from interface org.refcodes.component.Pausable.PauseAutomaton
isPausable, isPaused
Methods inherited from interface org.refcodes.eventbus.ext.application.PauseBus
onPause, onPause, onPause, onPause, onPause, onPause, onPause, onPause, publishPause, publishPause, publishPause, publishPause, publishPause, publishPause, publishPause, publishPause, publishPause, publishPause
Methods inherited from interface org.refcodes.component.Resumable
resume, resumeUnchecked
Methods inherited from interface org.refcodes.component.Resumable.ResumeAutomaton
isResumable
Methods inherited from interface org.refcodes.eventbus.ext.application.ResumeBus
onResume, onResume, onResume, onResume, onResume, onResume, onResume, onResume, publishResume, publishResume, publishResume, publishResume, publishResume, publishResume, publishResume, publishResume, publishResume, publishResume
Methods inherited from interface org.refcodes.component.RunningAccessor
isRunning
Methods inherited from interface org.refcodes.component.Startable
start, startUnchecked
Methods inherited from interface org.refcodes.component.Startable.StartAutomaton
isStartable
Methods inherited from interface org.refcodes.eventbus.ext.application.StartBus
onStart, onStart, onStart, onStart, onStart, onStart, onStart, onStart, publishStart, publishStart, publishStart, publishStart, publishStart, publishStart, publishStart, publishStart, publishStart, publishStart
Methods inherited from interface org.refcodes.eventbus.ext.application.StopBus
onStop, onStop, onStop, onStop, onStop, onStop, onStop, onStop, publishStop, publishStop, publishStop, publishStop, publishStop, publishStop, publishStop, publishStop, publishStop, publishStop
Methods inherited from interface org.refcodes.component.Stoppable
stop, stopUnchecked
Methods inherited from interface org.refcodes.component.Stoppable.StopAutomaton
isStoppable, isStopped
-
Method Details
-
onLifecycle
Subscribes aLifecycleBusObserver
forLifecycleBusEvent
instances to be passed to the accordingLifecycleBusObserver
methods.- Parameters:
aObserver
- The observer to be notified.- Returns:
- A handle to unsubscribe this combination.
-
onLifecycle
Subscribes aLifecycleBusObserver
forLifecycleBusEvent
instances with the given attributes to be passed to the accordingLifecycleBusObserver
methods.- Parameters:
aPublisherType
- The type of the event publisher.aObserver
- The observer to be notified.- Returns:
- A handle to unsubscribe this combination.
-
onLifecycle
Subscribes aLifecycleBusObserver
forLifecycleBusEvent
instances with the given attributes to be passed to the accordingLifecycleBusObserver
methods.- Parameters:
aChannel
- The channel name on which the event is receivable.aObserver
- The observer to be notified.- Returns:
- A handle to unsubscribe this combination.
-
onLifecycle
default String onLifecycle(String aAlias, String aGroup, String aChannel, String aUid, Class<?> aPublisherType, LifecycleBusObserver aObserver) Subscribes aLifecycleBusObserver
forLifecycleBusEvent
instances with the given attributes to be passed to the accordingLifecycleBusObserver
methods.- Parameters:
aAlias
- The alias property.aGroup
- The group property.aChannel
- The channel property.aUid
- The UID (Universal-TID) property.aPublisherType
- The type of the event publisher.aObserver
- The observer to be notified.- Returns:
- A handle to unsubscribe this combination.
-
onLifecycle
default String onLifecycle(Enum<?> aAction, Class<?> aPublisherType, LifecycleBusObserver aObserver) Subscribes aLifecycleBusObserver
forLifecycleBusEvent
instances with the given attributes to be passed to the accordingLifecycleBusObserver
methods.- Parameters:
aAction
- The action which this represents.aPublisherType
- The type of the event publisher.aObserver
- The observer to be notified.- Returns:
- A handle to unsubscribe this combination.
-
onLifecycle
Subscribes aLifecycleBusObserver
forLifecycleBusEvent
instances with the given attributes to be passed to the accordingLifecycleBusObserver
methods.- Parameters:
aAction
- The action which this represents.aChannel
- The channel name on which the event is receivable.aObserver
- The observer to be notified.- Returns:
- A handle to unsubscribe this combination.
-
onLifecycle
default String onLifecycle(Enum<?> aAction, String aAlias, String aGroup, String aChannel, String aUid, Class<?> aPublisherType, LifecycleBusObserver aObserver) Subscribes aLifecycleBusObserver
forLifecycleBusEvent
instances with the given attributes to be passed to the accordingLifecycleBusObserver
methods.- Parameters:
aAction
- The action which this represents.aAlias
- The alias property.aGroup
- The group property.aChannel
- The channel property.aUid
- The UID (Universal-TID) property.aPublisherType
- The type of the event publisher.aObserver
- The observer to be notified.- Returns:
- A handle to unsubscribe this combination.
-
onLifecycle
Subscribes aLifecycleBusObserver
forLifecycleBusEvent
instances with the given attributes to be passed to the accordingLifecycleBusObserver
methods.- Parameters:
aAction
- The action which this represents.aObserver
- The observer to be notified.- Returns:
- A handle to unsubscribe this combination.
-