S - the type of stateE - the type of eventpublic class ZookeeperStateMachineEnsemble<S,E> extends StateMachineEnsembleObjectSupport<S,E>
StateMachineEnsemble backed by a zookeeper.| Constructor and Description |
|---|
ZookeeperStateMachineEnsemble(org.apache.curator.framework.CuratorFramework curatorClient,
java.lang.String basePath)
Instantiates a new zookeeper state machine ensemble.
|
ZookeeperStateMachineEnsemble(org.apache.curator.framework.CuratorFramework curatorClient,
java.lang.String basePath,
boolean cleanState,
int logSize)
Instantiates a new zookeeper state machine ensemble.
|
| Modifier and Type | Method and Description |
|---|---|
protected reactor.core.publisher.Mono<java.lang.Void> |
doPreStartReactively()
Subclasses may implement this for pre start logic.
|
protected reactor.core.publisher.Mono<java.lang.Void> |
doPreStopReactively()
Subclasses may implement this for pre stop logic.
|
protected void |
doStart() |
protected void |
doStop() |
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.
|
protected void |
onInit()
Subclasses may implement this for initialization logic.
|
protected void |
registerWatcherForStatePath()
Register existing
CuratorWatcher for a state path. |
void |
setState(StateMachineContext<S,E> context)
Sets the state as a
StateMachineContext. |
java.lang.String |
toString() |
addEnsembleListener, notifyError, notifyGranted, notifyJoined, notifyLeft, notifyRevoked, notifyStateChanged, removeEnsembleListenerafterPropertiesSet, destroy, doDestroy, doPostStartReactively, doPostStopReactively, getBeanFactory, getPhase, isAutoStartup, isRunning, setAutoStartup, setBeanFactory, setPhase, start, startReactively, stop, stopReactivelypublic ZookeeperStateMachineEnsemble(org.apache.curator.framework.CuratorFramework curatorClient,
java.lang.String basePath)
curatorClient - the curator clientbasePath - the base zookeeper pathpublic ZookeeperStateMachineEnsemble(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 sizeprotected void onInit()
throws java.lang.Exception
LifecycleObjectSupportInitializingBean phase.onInit in class LifecycleObjectSupportjava.lang.Exception - exceptionprotected reactor.core.publisher.Mono<java.lang.Void> doPreStartReactively()
LifecycleObjectSupportdoPreStartReactively in class LifecycleObjectSupportprotected void doStart()
protected reactor.core.publisher.Mono<java.lang.Void> doPreStopReactively()
LifecycleObjectSupportdoPreStopReactively in class LifecycleObjectSupportprotected void doStop()
public void join(StateMachine<S,E> stateMachine)
StateMachineEnsembleEnsembleListener and
EnsembleListener.stateMachineJoined(StateMachine, StateMachineContext)
is called with a StateMachine instance for successful join.join in interface StateMachineEnsemble<S,E>join in class StateMachineEnsembleObjectSupport<S,E>stateMachine - the state machinepublic StateMachine<S,E> getLeader()
StateMachineEnsembleNULL it indicates that this ensemble
doesn't know any leader.public void leave(StateMachine<S,E> stateMachine)
StateMachineEnsembleStateMachine. Additionally
EnsembleListener.stateMachineLeft(StateMachine, StateMachineContext)
is called when leave request is fully processed.leave in interface StateMachineEnsemble<S,E>leave in class StateMachineEnsembleObjectSupport<S,E>stateMachine - the state machinepublic void setState(StateMachineContext<S,E> context)
StateMachineEnsembleStateMachineContext.context - the state machine contextpublic StateMachineContext<S,E> getState()
StateMachineEnsembleStateMachineContext.protected void registerWatcherForStatePath()
CuratorWatcher for a state path.public java.lang.String toString()
toString in class java.lang.Object