Class AbstractStateMachine<S extends Enum>
java.lang.Object
com.couchbase.client.dcp.core.state.AbstractStateMachine<S>
- All Implemented Interfaces:
Stateful<S>
- Direct Known Subclasses:
DcpChannel
Abstract
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.
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractStateMachine(S initialState) Creates a new state machine. -
Method Summary
-
Constructor Details
-
AbstractStateMachine
Creates a new state machine.- Parameters:
initialState- the initial state of the state machine.
-
-
Method Details
-
state
Description copied from interface:StatefulReturns the current state. -
isState
Description copied from interface:StatefulCheck if the given state is the same as the current one. -
transitionState
Transition into a new state.This method is intentionally not public, because the subclass should only be responsible for the actual transitions, the other components only react on those transitions eventually.
- Parameters:
newState- the states to transition into.
-