Interface EnsembleListener<S,E>
- Type Parameters:
S
- the type of stateE
- the type of event
- All Known Implementing Classes:
CompositeEnsembleListener
,EnsembleListenerAdapter
public interface EnsembleListener<S,E>
EnsembleListener
for various ensemble events.-
Method Summary
Modifier and TypeMethodDescriptionvoid
ensembleError
(StateMachineEnsembleException exception) Called whenStateMachineEnsemble
resulted an error.void
ensembleLeaderGranted
(StateMachine<S, E> stateMachine) Called when a state machine is granted a leader role in an ensemble.void
ensembleLeaderRevoked
(StateMachine<S, E> stateMachine) Called when a state machine is revoked from a leader role in an ensemble.void
stateChanged
(StateMachineContext<S, E> context) Called when ensemble is discovering a state change.void
stateMachineJoined
(StateMachine<S, E> stateMachine, StateMachineContext<S, E> context) Called when state machine joined an ensemble.void
stateMachineLeft
(StateMachine<S, E> stateMachine, StateMachineContext<S, E> context) Called when state machine left an ensemble.
-
Method Details
-
stateMachineJoined
Called when state machine joined an ensemble. This callback is guaranteed to be called for aStateMachine
who requested a join. User of this listener should check that aStateMachine
is the one interested of. Implementation may choose to notify otherStateMachine
joins if it is able to do so. This may be called multiple time in case ensemble has made a choice to leave machine due to ensemble errors.- Parameters:
stateMachine
- the state machinecontext
- the state machine context
-
stateMachineLeft
Called when state machine left an ensemble. This callback is guaranteed to be called for aStateMachine
who requested a leave. User of this listener should check that aStateMachine
is the one interested of. Implementation may choose to notify otherStateMachine
leaves if it is able to do so.- Parameters:
stateMachine
- the state machinecontext
- the state machine context
-
stateChanged
Called when ensemble is discovering a state change.- Parameters:
context
- the state machine context
-
ensembleError
Called whenStateMachineEnsemble
resulted an error.- Parameters:
exception
- the exception
-
ensembleLeaderGranted
Called when a state machine is granted a leader role in an ensemble.- Parameters:
stateMachine
- the state machine
-
ensembleLeaderRevoked
Called when a state machine is revoked from a leader role in an ensemble.- Parameters:
stateMachine
- the state machine
-