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.DelayedTransitionTo
is a specializedInstruction
forNonBlockingFiniteStateMachine
s that enables aStateEntryAction
to request a delayed transition to another state, unlike aInstruction.TransitionTo
Instruction
which 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.DelayedTransitionTo
without a specified time (to be schedule as soon as possible).DelayedTransitionTo(S desiredState, long lDuration, TimeUnit timeUnit)
Constructs aNonBlockingFiniteStateMachine.DelayedTransitionTo
with the specified time.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description S
getDesiredState(S currentState, ExecutionContext context)
Determines the desired state of theFiniteStateMachine
for theEvent
given the current state of theFiniteStateMachine
.long
getDuration()
Obtains the amount of time to wait before the transition to the desired state should occurTimeUnit
getTimeUnit()
Obtains theTimeUnit
for thegetDuration()
-
-
-
Constructor Detail
-
DelayedTransitionTo
public DelayedTransitionTo(S desiredState)
Constructs aNonBlockingFiniteStateMachine.DelayedTransitionTo
without 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.DelayedTransitionTo
with 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 theFiniteStateMachine
for theEvent
given the current state of theFiniteStateMachine
.- Specified by:
getDesiredState
in interfaceEvent<S extends Enum<S>>
- Parameters:
currentState
- the current state of theFiniteStateMachine
context
- theExecutionContext
for theEvent
- Returns:
- the desired state of the
FiniteStateMachine
ornull
if 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 theTimeUnit
for thegetDuration()
- Returns:
- the
TimeUnit
-
-