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.SubsequentEvent
is anEvent
that ensures that another (wrapped)Event
to occur if an only if theFiniteStateMachine
is at a certain transition count. Should an attempt to process the wrappedEvent
occur at another transition count, processing of the said event is ignored.NonBlockingFiniteStateMachine.SubsequentEvent
s are designed to provide the ability for future scheduledEvent
s to be skipped if anotherEvent
has been processed between the time when theNonBlockingFiniteStateMachine.SubsequentEvent
was requested to be processed and when it was actually processed. That is, the purpose of this is to allow anEvent
to be skipped if otherEvent
s interleave between the time when the saidEvent
was 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 S
getDesiredState(S currentState, ExecutionContext context)
Determines the desired state of theFiniteStateMachine
for theEvent
given the current state of theFiniteStateMachine
.boolean
onAccept(ExecutionContext context)
Called by aFiniteStateMachine
when theLifecycleAwareEvent
is initially about to be accepted for processing.void
onProcessed(ExecutionContext context)
Called by aFiniteStateMachine
when theLifecycleAwareEvent
has been processed.void
onProcessing(ExecutionContext context)
Called by aFiniteStateMachine
when theLifecycleAwareEvent
is about to be processed.String
toString()
-
-
-
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 aFiniteStateMachine
when theLifecycleAwareEvent
is initially about to be accepted for processing.- Specified by:
onAccept
in interfaceLifecycleAwareEvent<S extends Enum<S>>
- Parameters:
context
- theExecutionContext
for theEvent
- Returns:
true
if theEvent
should be accepted, orfalse
if theFiniteStateMachine
should ignore theLifecycleAwareEvent
-
onProcessed
public void onProcessed(ExecutionContext context)
Called by aFiniteStateMachine
when theLifecycleAwareEvent
has been processed.- Specified by:
onProcessed
in interfaceLifecycleAwareEvent<S extends Enum<S>>
- Parameters:
context
- theExecutionContext
for theEvent
-
onProcessing
public void onProcessing(ExecutionContext context)
Called by aFiniteStateMachine
when theLifecycleAwareEvent
is about to be processed.- Specified by:
onProcessing
in interfaceLifecycleAwareEvent<S extends Enum<S>>
- Parameters:
context
- theExecutionContext
for theEvent
-
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
-
-