public class AsyncLongEventHandler extends AsyncBaseEventHandler
AsyncBaseEventHandler that carries a
long value as payload.| Constructor and Description |
|---|
AsyncLongEventHandler()
Creates an instance of
AsyncLongEventHandler (ALEH) with default
values for all parameters. |
AsyncLongEventHandler(java.util.function.LongConsumer logic)
Calling this constructor is equivalent to calling
AsyncLongEventHandler(SchedulingParameters,
ReleaseParameters,
MemoryParameters,
MemoryArea,
ConfigurationParameters,
ReleaseRunner,
LongConsumer)
with arguments (null, null, null, null, null, null, logic). |
AsyncLongEventHandler(SchedulingParameters scheduling,
ReleaseParameters<?> release)
Calling this constructor is equivalent to calling
AsyncLongEventHandler(SchedulingParameters,
ReleaseParameters,
MemoryParameters,
MemoryArea,
ConfigurationParameters,
ReleaseRunner,
LongConsumer)
with arguments (scheduling, release, null, null, null, null, null) |
AsyncLongEventHandler(SchedulingParameters scheduling,
ReleaseParameters<?> release,
java.util.function.LongConsumer logic)
Calling this constructor is equivalent to calling
AsyncLongEventHandler(SchedulingParameters,
ReleaseParameters,
MemoryParameters,
MemoryArea,
ConfigurationParameters,
ReleaseRunner,
LongConsumer)
with arguments (scheduling, release, null, null, null, null, logic). |
AsyncLongEventHandler(SchedulingParameters scheduling,
ReleaseParameters<?> release,
MemoryParameters memory,
MemoryArea area,
ConfigurationParameters config,
ReleaseRunner runner,
java.util.function.LongConsumer logic)
Creates an asynchronous event handler that receives a
Long
payload with each fire. |
| Modifier and Type | Method and Description |
|---|---|
void |
handleAsyncEvent(long payload)
This method holds the logic which is to be executed when any
AsyncEvent with which this handler is associated is fired. |
long |
peekPending()
Determines the next value queued for handling.
|
void |
release(long payload)
Release this handler directly.
|
addToFeasibility, getAndClearPendingFireCount, getAndDecrementPendingFireCount, getConfigurationParameters, getCurrentReleaseTime, getCurrentReleaseTime, getMemoryArea, getMemoryParameters, getPendingFireCount, getProcessingGroupParameters, getQueueLength, getReleaseParameters, getReleaseRunner, getScheduler, getSchedulingParameters, isArmed, isDaemon, mayUseHeap, removeFromFeasibility, run, setDaemon, setMemoryParameters, setProcessingGroupParameters, setReleaseParameters, setScheduler, setScheduler, setSchedulingParameters, subsumespublic AsyncLongEventHandler(SchedulingParameters scheduling, ReleaseParameters<?> release, MemoryParameters memory, MemoryArea area, ConfigurationParameters config, ReleaseRunner runner, java.util.function.LongConsumer logic) throws StaticIllegalArgumentException
Long
payload with each fire.scheduling - Parameter for scheduling the new handler
(and possibly other instances of Schedulable). When
scheduling is null and the
creator is an instance of Schedulable,
SchedulingParameters is a clone of the creator's value
created in the same memory area as this. When
scheduling is null and the creator is
a task that is not an instance of Schedulable, the
contents and type of the new SchedulingParameters
object are governed by the associated scheduler.release - Parameter for scheduling the new handler
(and possibly other instances of Schedulable). When
release is null the new
AsyncEventHandler will use a clone of the
default ReleaseParameters for the associated
scheduler created in the memory area that contains the
AsyncEventHandler object.memory - Parameter for scheduling the new handler
(and possibly other instances of Schedulable). When
memory is null, the new
AsyncEventHandler receives null value
for its memory parameters, and the amount or rate of memory
allocation for the new handler is unrestricted.area - The initial memory area of this handler.runner - Logic to be executed by handleAsyncEvent(long)logic - The logic to run for each fire. When logic
is null, the handleAsyncEvent()
method in the new object will serve as its logic.StaticIllegalArgumentException - when the event queue
overflow policy is QueueOverflowPolicy.DISABLE.public AsyncLongEventHandler(SchedulingParameters scheduling, ReleaseParameters<?> release, java.util.function.LongConsumer logic) throws StaticIllegalArgumentException
AsyncLongEventHandler(SchedulingParameters,
ReleaseParameters,
MemoryParameters,
MemoryArea,
ConfigurationParameters,
ReleaseRunner,
LongConsumer)
with arguments (scheduling, release, null, null, null, null, logic).StaticIllegalArgumentExceptionpublic AsyncLongEventHandler(SchedulingParameters scheduling, ReleaseParameters<?> release) throws StaticIllegalArgumentException
AsyncLongEventHandler(SchedulingParameters,
ReleaseParameters,
MemoryParameters,
MemoryArea,
ConfigurationParameters,
ReleaseRunner,
LongConsumer)
with arguments (scheduling, release, null, null, null, null, null)StaticIllegalArgumentExceptionpublic AsyncLongEventHandler(java.util.function.LongConsumer logic)
AsyncLongEventHandler(SchedulingParameters,
ReleaseParameters,
MemoryParameters,
MemoryArea,
ConfigurationParameters,
ReleaseRunner,
LongConsumer)
with arguments (null, null, null, null, null, null, logic).public AsyncLongEventHandler()
AsyncLongEventHandler (ALEH) with default
values for all parameters.public void handleAsyncEvent(long payload)
AsyncEvent with which this handler is associated is fired.
This method will be invoked repeatedly while fireCount is
greater than zero.
The default implementation of this method invokes the run
method of any non-null logic instance passed to the
constructor of this handler.
This AEH acts as a source of "reference" for its initial memory area while it is released.
All throwables from (or propagated through) handleAsyncEvent
are caught, a stack trace is printed and execution continues as if
handleAsyncEvent had returned normally.
payload - It is the long value associated with a fire.public long peekPending()
throws StaticIllegalStateException
handleAsyncEvent(long).StaticIllegalStateException - when the fire count is zero.public void release(long payload)
payload - The long to be passed to the handler.