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.- Author:
- Janne Valkealahti
-
Method Summary
Modifier and TypeMethodDescriptionvoidensembleError(StateMachineEnsembleException exception) Called whenStateMachineEnsembleresulted an error.voidensembleLeaderGranted(StateMachine<S, E> stateMachine) Called when a state machine is granted a leader role in an ensemble.voidensembleLeaderRevoked(StateMachine<S, E> stateMachine) Called when a state machine is revoked from a leader role in an ensemble.voidstateChanged(StateMachineContext<S, E> context) Called when ensemble is discovering a state change.voidstateMachineJoined(StateMachine<S, E> stateMachine, StateMachineContext<S, E> context) Called when state machine joined an ensemble.voidstateMachineLeft(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 aStateMachinewho requested a join. User of this listener should check that aStateMachineis the one interested of. Implementation may choose to notify otherStateMachinejoins 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 aStateMachinewho requested a leave. User of this listener should check that aStateMachineis the one interested of. Implementation may choose to notify otherStateMachineleaves 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 whenStateMachineEnsembleresulted 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
-