S - the type of the state for the FiniteStateMachinepublic static class NonBlockingFiniteStateMachine.CoalescedEvent<S extends Enum<S>> extends Object implements LifecycleAwareEvent<S>
NonBlockingFiniteStateMachine.CoalescedEvent is a LifecycleAwareEvent that
 coalesces other (wrapped) Events with the same discriminator
 so that only one Event actually executes.
 
 For example:  Given 10 Events submitted to a NonBlockingFiniteStateMachine with the same discriminator, only one
 of the said Events will be processed.  All others will be
 discarded.  Once the NonBlockingFiniteStateMachine.CoalescedEvent has been processed, a new
 batch may be created when another NonBlockingFiniteStateMachine.CoalescedEvent of the same
 discriminator is submitted.
 
 The actual Event processed depends on the mode of coalescing
 required.  The first NonBlockingFiniteStateMachine.CoalescedEvent submitted to a NonBlockingFiniteStateMachine for a specific discriminator
 effectively starts the coalescing of Events for the said
 discriminator.  When the mode is set to NonBlockingFiniteStateMachine.CoalescedEvent.Process.FIRST, then
 the first Event (starting the coalescing) will be processed
 and others will be discarded. When the mode is set of NonBlockingFiniteStateMachine.CoalescedEvent.Process.MOST_RECENT then the most recently submitted Event
 will be processed and likewise, all others for the same discriminator
 will be discarded.
| Modifier and Type | Class and Description | 
|---|---|
static class  | 
NonBlockingFiniteStateMachine.CoalescedEvent.Discriminator
A  
NonBlockingFiniteStateMachine.CoalescedEvent.Discriminator is an object that is used to uniquely
 differentiate events to be coalesced, scoped by a NonBlockingFiniteStateMachine. | 
static class  | 
NonBlockingFiniteStateMachine.CoalescedEvent.Process
The  
NonBlockingFiniteStateMachine.CoalescedEvent to process. | 
| Constructor and Description | 
|---|
CoalescedEvent(Event<S> event)
Constructs a  
NonBlockingFiniteStateMachine.CoalescedEvent of the specified Event
 type using NonBlockingFiniteStateMachine.CoalescedEvent.Process.FIRST. | 
CoalescedEvent(Event<S> event,
              NonBlockingFiniteStateMachine.CoalescedEvent.Process mode)
Constructs a  
NonBlockingFiniteStateMachine.CoalescedEvent of the specified Event type. | 
CoalescedEvent(Event<S> event,
              NonBlockingFiniteStateMachine.CoalescedEvent.Process mode,
              Object discriminator)
Constructs a  
NonBlockingFiniteStateMachine.CoalescedEvent with the specified discriminator and Event. | 
| Modifier and Type | Method and Description | 
|---|---|
S | 
getDesiredState(S state,
               ExecutionContext context)
Determines the desired state of the  
FiniteStateMachine for the
 Event given the current state of the FiniteStateMachine. | 
boolean | 
onAccept(ExecutionContext context)
Called by a  
FiniteStateMachine when the LifecycleAwareEvent
 is initially about to be accepted for processing. | 
void | 
onProcessed(ExecutionContext context)
Called by a  
FiniteStateMachine when the LifecycleAwareEvent
 has been processed. | 
void | 
onProcessing(ExecutionContext context)
Called by a  
FiniteStateMachine when the LifecycleAwareEvent
 is about to be processed. | 
String | 
toString() | 
public CoalescedEvent(Event<S> event)
NonBlockingFiniteStateMachine.CoalescedEvent of the specified Event
 type using NonBlockingFiniteStateMachine.CoalescedEvent.Process.FIRST.event - the Event to be executed when coalescedpublic CoalescedEvent(Event<S> event, NonBlockingFiniteStateMachine.CoalescedEvent.Process mode)
NonBlockingFiniteStateMachine.CoalescedEvent of the specified Event type.event - the Event to be coalescedmode - which NonBlockingFiniteStateMachine.CoalescedEvents to processpublic CoalescedEvent(Event<S> event, NonBlockingFiniteStateMachine.CoalescedEvent.Process mode, Object discriminator)
NonBlockingFiniteStateMachine.CoalescedEvent with the specified discriminator and Event.event - the Event to be coalescedmode - which NonBlockingFiniteStateMachine.CoalescedEvents to processdiscriminator - the descriminator used to uniquely coalesce
                      the Eventpublic S getDesiredState(S state, ExecutionContext context)
FiniteStateMachine for the
 Event given the current state of the FiniteStateMachine.getDesiredState in interface Event<S extends Enum<S>>state - the current state of the FiniteStateMachinecontext - the ExecutionContext for the EventFiniteStateMachine or
          null if no transition is requiredpublic boolean onAccept(ExecutionContext context)
FiniteStateMachine when the LifecycleAwareEvent
 is initially about to be accepted for processing.onAccept in interface LifecycleAwareEvent<S extends Enum<S>>context - the ExecutionContext for the Eventtrue if the Event should be accepted, or
         false if the FiniteStateMachine should
         ignore the LifecycleAwareEventpublic void onProcessed(ExecutionContext context)
FiniteStateMachine when the LifecycleAwareEvent
 has been processed.onProcessed in interface LifecycleAwareEvent<S extends Enum<S>>context - the ExecutionContext for the Eventpublic void onProcessing(ExecutionContext context)
FiniteStateMachine when the LifecycleAwareEvent
 is about to be processed.onProcessing in interface LifecycleAwareEvent<S extends Enum<S>>context - the ExecutionContext for the Event