Interface EnsembleListener<S,E>

Type Parameters:
S - the type of state
E - the type of event
All Known Implementing Classes:
CompositeEnsembleListener, EnsembleListenerAdapter

public interface EnsembleListener<S,E>
EnsembleListener for various ensemble events.
Author:
Janne Valkealahti
  • Method Details

    • stateMachineJoined

      void stateMachineJoined(StateMachine<S,E> stateMachine, StateMachineContext<S,E> context)
      Called when state machine joined an ensemble. This callback is guaranteed to be called for a StateMachine who requested a join. User of this listener should check that a StateMachine is the one interested of. Implementation may choose to notify other StateMachine 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 machine
      context - the state machine context
    • stateMachineLeft

      void stateMachineLeft(StateMachine<S,E> stateMachine, StateMachineContext<S,E> context)
      Called when state machine left an ensemble. This callback is guaranteed to be called for a StateMachine who requested a leave. User of this listener should check that a StateMachine is the one interested of. Implementation may choose to notify other StateMachine leaves if it is able to do so.
      Parameters:
      stateMachine - the state machine
      context - the state machine context
    • stateChanged

      void stateChanged(StateMachineContext<S,E> context)
      Called when ensemble is discovering a state change.
      Parameters:
      context - the state machine context
    • ensembleError

      void ensembleError(StateMachineEnsembleException exception)
      Called when StateMachineEnsemble resulted an error.
      Parameters:
      exception - the exception
    • ensembleLeaderGranted

      void ensembleLeaderGranted(StateMachine<S,E> stateMachine)
      Called when a state machine is granted a leader role in an ensemble.
      Parameters:
      stateMachine - the state machine
    • ensembleLeaderRevoked

      void ensembleLeaderRevoked(StateMachine<S,E> stateMachine)
      Called when a state machine is revoked from a leader role in an ensemble.
      Parameters:
      stateMachine - the state machine