public class AbstractStateMachine<S extends Enum> extends Object implements Stateful<S>
Stateful implementation which acts like a simple state machine.
This class is thread safe, so state transitions can be issued from any thread without any further synchronization.| Modifier | Constructor and Description |
|---|---|
protected |
AbstractStateMachine(S initialState)
Creates a new state machine.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
isState(S state)
Check if the given state is the same as the current one.
|
S |
state()
Returns the current state.
|
protected void |
transitionState(S newState)
Transition into a new state.
|
protected AbstractStateMachine(S initialState)
initialState - the initial state of the state machine.public final boolean isState(S state)
Statefulprotected void transitionState(S newState)
newState - the states to transition into.Copyright © 2021 Couchbase, Inc.. All rights reserved.