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.SubsequentEvent
s are designed to provide the ability for
future scheduled Event
s 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 Event
s interleave between the time when the said Event
was actually scheduled and when it was actually meant to be
processed.
-
Constructor Summary
ConstructorDescriptionSubsequentEvent
(Event<S> event) Constructs aNonBlockingFiniteStateMachine.SubsequentEvent
. -
Method Summary
Modifier and TypeMethodDescriptiongetDesiredState
(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.toString()
-
Constructor Details
-
SubsequentEvent
Constructs aNonBlockingFiniteStateMachine.SubsequentEvent
.- Parameters:
event
- the actual event to process
-
-
Method Details
-
onAccept
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
Called by aFiniteStateMachine
when theLifecycleAwareEvent
has been processed.- Specified by:
onProcessed
in interfaceLifecycleAwareEvent<S extends Enum<S>>
- Parameters:
context
- theExecutionContext
for theEvent
-
onProcessing
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
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
-
toString
-