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>
ANonBlockingFiniteStateMachine.SubsequentEventis anEventthat ensures that another (wrapped)Eventto occur if an only if theFiniteStateMachineis at a certain transition count. Should an attempt to process the wrappedEventoccur at another transition count, processing of the said event is ignored.NonBlockingFiniteStateMachine.SubsequentEvents are designed to provide the ability for future scheduledEvents to be skipped if anotherEventhas been processed between the time when theNonBlockingFiniteStateMachine.SubsequentEventwas requested to be processed and when it was actually processed. That is, the purpose of this is to allow anEventto be skipped if otherEvents interleave between the time when the saidEventwas actually scheduled and when it was actually meant to be processed.
-
-
Constructor Summary
Constructors Constructor Description SubsequentEvent(Event<S> event)Constructs aNonBlockingFiniteStateMachine.SubsequentEvent.
-
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.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.StringtoString()
-
-
-
Constructor Detail
-
SubsequentEvent
public SubsequentEvent(Event<S> event)
Constructs aNonBlockingFiniteStateMachine.SubsequentEvent.- Parameters:
event- the actual event to process
-
-
Method Detail
-
onAccept
public boolean onAccept(ExecutionContext context)
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
public void onProcessed(ExecutionContext context)
Called by aFiniteStateMachinewhen theLifecycleAwareEventhas been processed.- Specified by:
onProcessedin interfaceLifecycleAwareEvent<S extends Enum<S>>- Parameters:
context- theExecutionContextfor theEvent
-
onProcessing
public void onProcessing(ExecutionContext context)
Called by aFiniteStateMachinewhen theLifecycleAwareEventis about to be processed.- Specified by:
onProcessingin interfaceLifecycleAwareEvent<S extends Enum<S>>- Parameters:
context- theExecutionContextfor theEvent
-
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
-
-