S
- the type of stateE
- the type of eventpublic class DefaultStateMachineService<S,E> extends java.lang.Object implements StateMachineService<S,E>, org.springframework.beans.factory.DisposableBean
StateMachineService
.Constructor and Description |
---|
DefaultStateMachineService(StateMachineFactory<S,E> stateMachineFactory)
Instantiates a new default state machine service.
|
DefaultStateMachineService(StateMachineFactory<S,E> stateMachineFactory,
StateMachinePersist<S,E,java.lang.String> stateMachinePersist)
Instantiates a new default state machine service.
|
Modifier and Type | Method and Description |
---|---|
StateMachine<S,E> |
acquireStateMachine(java.lang.String machineId)
Acquires the state machine.
|
StateMachine<S,E> |
acquireStateMachine(java.lang.String machineId,
boolean start)
Acquires the state machine.
|
void |
destroy() |
protected void |
doStop() |
protected StateMachine<S,E> |
handleStart(StateMachine<S,E> stateMachine,
boolean start) |
protected StateMachine<S,E> |
handleStop(StateMachine<S,E> stateMachine,
boolean stop) |
boolean |
hasStateMachine(java.lang.String machineId)
Determines if the given machine identifier denotes a known managed state machine.
|
void |
releaseStateMachine(java.lang.String machineId)
Release the state machine.
|
void |
releaseStateMachine(java.lang.String machineId,
boolean stop)
Release state machine.
|
protected StateMachine<S,E> |
restoreStateMachine(StateMachine<S,E> stateMachine,
StateMachineContext<S,E> stateMachineContext) |
void |
setStateMachinePersist(StateMachinePersist<S,E,java.lang.String> stateMachinePersist)
Sets the state machine persist.
|
public DefaultStateMachineService(StateMachineFactory<S,E> stateMachineFactory)
stateMachineFactory
- the state machine factorypublic DefaultStateMachineService(StateMachineFactory<S,E> stateMachineFactory, StateMachinePersist<S,E,java.lang.String> stateMachinePersist)
stateMachineFactory
- the state machine factorystateMachinePersist
- the state machine persistpublic final void destroy() throws java.lang.Exception
destroy
in interface org.springframework.beans.factory.DisposableBean
java.lang.Exception
public StateMachine<S,E> acquireStateMachine(java.lang.String machineId)
StateMachineService
acquireStateMachine
in interface StateMachineService<S,E>
machineId
- the machine idStateMachineService.acquireStateMachine(String, boolean)
public StateMachine<S,E> acquireStateMachine(java.lang.String machineId, boolean start)
StateMachineService
acquireStateMachine
in interface StateMachineService<S,E>
machineId
- the machine idstart
- indicating if machine should be returned startedpublic void releaseStateMachine(java.lang.String machineId)
StateMachineService
releaseStateMachine
in interface StateMachineService<S,E>
machineId
- the machine idStateMachineService.releaseStateMachine(String, boolean)
public void releaseStateMachine(java.lang.String machineId, boolean stop)
StateMachineService
releaseStateMachine
in interface StateMachineService<S,E>
machineId
- the machine idstop
- indicating if machine should be stoppedpublic boolean hasStateMachine(java.lang.String machineId)
machineId
- machine identifierpublic void setStateMachinePersist(StateMachinePersist<S,E,java.lang.String> stateMachinePersist)
stateMachinePersist
- the state machine persistprotected void doStop()
protected StateMachine<S,E> restoreStateMachine(StateMachine<S,E> stateMachine, StateMachineContext<S,E> stateMachineContext)
protected StateMachine<S,E> handleStart(StateMachine<S,E> stateMachine, boolean start)
protected StateMachine<S,E> handleStop(StateMachine<S,E> stateMachine, boolean stop)