S
- the type of stateE
- the type of eventpublic interface StateMachineEnsemble<S,E>
StateMachineEnsemble
is a contract between a StateMachine
and
arbitrary ensemble of other StateMachine
s.Modifier and Type | Method and Description |
---|---|
void |
addEnsembleListener(EnsembleListener<S,E> listener)
Adds the ensemble listener.
|
StateMachine<S,E> |
getLeader()
Gets the ensemble leader.
|
StateMachineContext<S,E> |
getState()
Gets the state as a
StateMachineContext . |
void |
join(StateMachine<S,E> stateMachine)
Request a join to a state machine ensemble.
|
void |
leave(StateMachine<S,E> stateMachine)
Request a leave from an ensemble.
|
void |
removeEnsembleListener(EnsembleListener<S,E> listener)
Removes the ensemble listener.
|
void |
setState(StateMachineContext<S,E> context)
Sets the state as a
StateMachineContext . |
void join(StateMachine<S,E> stateMachine)
EnsembleListener
and
EnsembleListener.stateMachineJoined(StateMachine, StateMachineContext)
is called with a StateMachine
instance for successful join.stateMachine
- the state machinevoid leave(StateMachine<S,E> stateMachine)
StateMachine
. Additionally
EnsembleListener.stateMachineLeft(StateMachine, StateMachineContext)
is called when leave request is fully processed.stateMachine
- the state machinevoid addEnsembleListener(EnsembleListener<S,E> listener)
listener
- the listenervoid removeEnsembleListener(EnsembleListener<S,E> listener)
listener
- the listenervoid setState(StateMachineContext<S,E> context)
StateMachineContext
.context
- the state machine contextStateMachineContext<S,E> getState()
StateMachineContext
.StateMachine<S,E> getLeader()
NULL
it indicates that this ensemble
doesn't know any leader.