Package com.tangosol.util.fsm
Class NonBlockingFiniteStateMachine.DelayedTransitionTo<S extends Enum<S>>
- java.lang.Object
-
- com.tangosol.util.fsm.NonBlockingFiniteStateMachine.DelayedTransitionTo<S>
-
- All Implemented Interfaces:
Event<S>,Instruction
- Enclosing class:
- NonBlockingFiniteStateMachine<S extends Enum<S>>
public static class NonBlockingFiniteStateMachine.DelayedTransitionTo<S extends Enum<S>> extends Object implements Instruction, Event<S>
ANonBlockingFiniteStateMachine.DelayedTransitionTois a specializedInstructionforNonBlockingFiniteStateMachines that enables aStateEntryActionto request a delayed transition to another state, unlike aInstruction.TransitionToInstructionwhich occurs immediately.- See Also:
Instruction.TransitionTo
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.tangosol.util.fsm.Instruction
Instruction.ProcessEvent<S extends Enum<S>>, Instruction.TransitionTo<S extends Enum<S>>
-
-
Field Summary
-
Fields inherited from interface com.tangosol.util.fsm.Instruction
NOTHING, STOP
-
-
Constructor Summary
Constructors Constructor Description DelayedTransitionTo(S desiredState)Constructs aNonBlockingFiniteStateMachine.DelayedTransitionTowithout a specified time (to be schedule as soon as possible).DelayedTransitionTo(S desiredState, long lDuration, TimeUnit timeUnit)Constructs aNonBlockingFiniteStateMachine.DelayedTransitionTowith the specified time.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SgetDesiredState(S currentState, ExecutionContext context)Determines the desired state of theFiniteStateMachinefor theEventgiven the current state of theFiniteStateMachine.longgetDuration()Obtains the amount of time to wait before the transition to the desired state should occurTimeUnitgetTimeUnit()Obtains theTimeUnitfor thegetDuration()
-
-
-
Constructor Detail
-
DelayedTransitionTo
public DelayedTransitionTo(S desiredState)
Constructs aNonBlockingFiniteStateMachine.DelayedTransitionTowithout a specified time (to be schedule as soon as possible).- Parameters:
desiredState- the desired state to which to transition
-
DelayedTransitionTo
public DelayedTransitionTo(S desiredState, long lDuration, TimeUnit timeUnit)
Constructs aNonBlockingFiniteStateMachine.DelayedTransitionTowith the specified time.- Parameters:
desiredState- the desired state to which to transitionlDuration- the amount of time to wait before the desired transition should occurtimeUnit- the unit of time measure
-
-
Method Detail
-
getDesiredState
public S getDesiredState(S currentState, ExecutionContext context)
Determines the desired state of theFiniteStateMachinefor theEventgiven the current state of theFiniteStateMachine.- Specified by:
getDesiredStatein interfaceEvent<S extends Enum<S>>- Parameters:
currentState- the current state of theFiniteStateMachinecontext- theExecutionContextfor theEvent- Returns:
- the desired state of the
FiniteStateMachineornullif no transition is required
-
getDuration
public long getDuration()
Obtains the amount of time to wait before the transition to the desired state should occur- Returns:
- the amount of time in the
getTimeUnit()
-
getTimeUnit
public TimeUnit getTimeUnit()
Obtains theTimeUnitfor thegetDuration()- Returns:
- the
TimeUnit
-
-