S
- the type of stateE
- the type of eventpublic class LeaderZookeeperStateMachineEnsemble<S,E> extends ZookeeperStateMachineEnsemble<S,E>
StateMachineEnsemble
backed by a zookeeper and leader functionality
from a Spring Cloud Cluster.Constructor and Description |
---|
LeaderZookeeperStateMachineEnsemble(org.apache.curator.framework.CuratorFramework curatorClient,
java.lang.String basePath)
Instantiates a new leader zookeeper state machine ensemble.
|
LeaderZookeeperStateMachineEnsemble(org.apache.curator.framework.CuratorFramework curatorClient,
java.lang.String basePath,
boolean cleanState,
int logSize)
Instantiates a new leader zookeeper state machine ensemble.
|
Modifier and Type | Method and Description |
---|---|
StateMachine<S,E> |
getLeader()
Gets the ensemble leader.
|
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.
|
doPreStartReactively, doPreStopReactively, doStart, doStop, getState, onInit, registerWatcherForStatePath, setState, toString
addEnsembleListener, notifyError, notifyGranted, notifyJoined, notifyLeft, notifyRevoked, notifyStateChanged, removeEnsembleListener
afterPropertiesSet, destroy, doDestroy, doPostStartReactively, doPostStopReactively, getBeanFactory, getPhase, isAutoStartup, isRunning, setAutoStartup, setBeanFactory, setPhase, start, startReactively, stop, stopReactively
public LeaderZookeeperStateMachineEnsemble(org.apache.curator.framework.CuratorFramework curatorClient, java.lang.String basePath)
curatorClient
- the curator clientbasePath
- the base zookeeper pathpublic LeaderZookeeperStateMachineEnsemble(org.apache.curator.framework.CuratorFramework curatorClient, java.lang.String basePath, boolean cleanState, int logSize)
curatorClient
- the curator clientbasePath
- the base zookeeper pathcleanState
- if true clean existing statelogSize
- the log sizepublic void join(StateMachine<S,E> stateMachine)
StateMachineEnsemble
EnsembleListener
and
EnsembleListener.stateMachineJoined(StateMachine, StateMachineContext)
is called with a StateMachine
instance for successful join.join
in interface StateMachineEnsemble<S,E>
join
in class ZookeeperStateMachineEnsemble<S,E>
stateMachine
- the state machinepublic void leave(StateMachine<S,E> stateMachine)
StateMachineEnsemble
StateMachine
. Additionally
EnsembleListener.stateMachineLeft(StateMachine, StateMachineContext)
is called when leave request is fully processed.leave
in interface StateMachineEnsemble<S,E>
leave
in class ZookeeperStateMachineEnsemble<S,E>
stateMachine
- the state machinepublic StateMachine<S,E> getLeader()
StateMachineEnsemble
NULL
it indicates that this ensemble
doesn't know any leader.getLeader
in interface StateMachineEnsemble<S,E>
getLeader
in class ZookeeperStateMachineEnsemble<S,E>