Package com.tangosol.util.fsm
Class NonBlockingFiniteStateMachine.SubsequentEvent<S extends Enum<S>>
java.lang.Object
com.tangosol.util.fsm.NonBlockingFiniteStateMachine.SubsequentEvent<S>
- Type Parameters:
S- the state type of theFiniteStateMachine
- All Implemented Interfaces:
Event<S>,LifecycleAwareEvent<S>
- Enclosing class:
NonBlockingFiniteStateMachine<S extends Enum<S>>
public static class NonBlockingFiniteStateMachine.SubsequentEvent<S extends Enum<S>>
extends Object
implements LifecycleAwareEvent<S>
A
NonBlockingFiniteStateMachine.SubsequentEvent is an Event that ensures that
another (wrapped) Event to occur if an only if the FiniteStateMachine is at a certain transition count. Should an
attempt to process the wrapped Event occur at another
transition count, processing of the said event is ignored.
NonBlockingFiniteStateMachine.SubsequentEvents are designed to provide the ability for
future scheduled Events to be skipped if another Event
has been processed between the time when the NonBlockingFiniteStateMachine.SubsequentEvent
was requested to be processed and when it was actually processed. That
is, the purpose of this is to allow an Event to be skipped if
other Events interleave between the time when the said Event was actually scheduled and when it was actually meant to be
processed.
-
Constructor Summary
ConstructorsConstructorDescriptionSubsequentEvent(Event<S> event) Constructs aNonBlockingFiniteStateMachine.SubsequentEvent. -
Method Summary
Modifier and TypeMethodDescriptiongetDesiredState(S currentState, ExecutionContext context) Determines the desired state of theFiniteStateMachinefor theEventgiven the current state of theFiniteStateMachine.booleanonAccept(ExecutionContext context) Called by aFiniteStateMachinewhen theLifecycleAwareEventis initially about to be accepted for processing.voidonProcessed(ExecutionContext context) Called by aFiniteStateMachinewhen theLifecycleAwareEventhas been processed.voidonProcessing(ExecutionContext context) Called by aFiniteStateMachinewhen theLifecycleAwareEventis about to be processed.toString()
-
Constructor Details
-
SubsequentEvent
Constructs aNonBlockingFiniteStateMachine.SubsequentEvent.- Parameters:
event- the actual event to process
-
-
Method Details
-
onAccept
Called by aFiniteStateMachinewhen theLifecycleAwareEventis initially about to be accepted for processing.- Specified by:
onAcceptin interfaceLifecycleAwareEvent<S extends Enum<S>>- Parameters:
context- theExecutionContextfor theEvent- Returns:
trueif theEventshould be accepted, orfalseif theFiniteStateMachineshould ignore theLifecycleAwareEvent
-
onProcessed
Called by aFiniteStateMachinewhen theLifecycleAwareEventhas been processed.- Specified by:
onProcessedin interfaceLifecycleAwareEvent<S extends Enum<S>>- Parameters:
context- theExecutionContextfor theEvent
-
onProcessing
Called by aFiniteStateMachinewhen theLifecycleAwareEventis about to be processed.- Specified by:
onProcessingin interfaceLifecycleAwareEvent<S extends Enum<S>>- Parameters:
context- theExecutionContextfor theEvent
-
getDesiredState
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
-
toString
-