P
- is the type of Object received.public class AsyncObjectEventHandler<P> extends AsyncBaseEventHandler
AsyncBaseEventHandler
that carries an
Object
value as payload.Constructor and Description |
---|
AsyncObjectEventHandler()
Creates an instance of
AsyncObjectEventHandler (AOEH) with default
values for all parameters. |
AsyncObjectEventHandler(Consumer<P> logic)
Calling this constructor is equivalent to calling
AsyncObjectEventHandler(SchedulingParameters,
ReleaseParameters,
MemoryParameters,
MemoryArea,
ReleaseRunner,
Consumer)
with arguments (null, null, null, null, null, null, logic) . |
AsyncObjectEventHandler(SchedulingParameters scheduling,
ReleaseParameters<?> release)
Calling this constructor is equivalent to calling
AsyncObjectEventHandler(SchedulingParameters,
ReleaseParameters,
MemoryParameters,
MemoryArea,
ReleaseRunner,
Consumer)
with arguments (scheduling, release, null, null, null, null) |
AsyncObjectEventHandler(SchedulingParameters scheduling,
ReleaseParameters<?> release,
Consumer<P> logic)
Calling this constructor is equivalent to calling
AsyncObjectEventHandler(SchedulingParameters,
ReleaseParameters,
MemoryParameters,
MemoryArea,
ReleaseRunner,
Consumer)
with arguments (scheduling, release, null, null, null, logic) . |
AsyncObjectEventHandler(SchedulingParameters scheduling,
ReleaseParameters<?> release,
MemoryParameters memory,
MemoryArea area,
ReleaseRunner runner,
Consumer<P> logic)
Creates an asynchronous event handler that receives an
Object
payload with each fire. |
Modifier and Type | Method and Description |
---|---|
void |
handleAsyncEvent(P payload)
This method holds the logic which is to be executed when any
AsyncEvent with which this handler is associated is fired. |
P |
peekPending()
Determines the next value queued for handling.
|
addIfFeasible, addToFeasibility, finalize, getAndClearPendingFireCount, getAndDecrementPendingFireCount, getDispatcher, getMemoryArea, getMemoryParameters, getPendingFireCount, getProcessingGroupParameters, getReleaseParameters, getScheduler, getSchedulingParameters, isDaemon, mayUseHeap, removeFromFeasibility, run, setDaemon, setIfFeasible, setIfFeasible, setIfFeasible, setIfFeasible, setIfFeasible, setMemoryParameters, setMemoryParametersIfFeasible, setProcessingGroupParameters, setProcessingGroupParametersIfFeasible, setReleaseParameters, setReleaseParametersIfFeasible, setScheduler, setScheduler, setSchedulingParameters, setSchedulingParametersIfFeasible, subsumes
public AsyncObjectEventHandler(SchedulingParameters scheduling, ReleaseParameters<?> release, MemoryParameters memory, MemoryArea area, ReleaseRunner runner, Consumer<P> logic) throws StaticIllegalArgumentException
Object
payload with each fire.StaticIllegalArgumentException
- when the event queue
overflow policy is QueueOverflowPolicy.DISABLE
.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(P)
logic
- The logic to run for each fire. When logic
is null
, the handleAsyncEvent
method in the new object will serve as its logic.public AsyncObjectEventHandler(SchedulingParameters scheduling, ReleaseParameters<?> release, Consumer<P> logic) throws StaticIllegalArgumentException
AsyncObjectEventHandler(SchedulingParameters,
ReleaseParameters,
MemoryParameters,
MemoryArea,
ReleaseRunner,
Consumer)
with arguments (scheduling, release, null, null, null, logic)
.StaticIllegalArgumentException
public AsyncObjectEventHandler(SchedulingParameters scheduling, ReleaseParameters<?> release) throws StaticIllegalArgumentException
AsyncObjectEventHandler(SchedulingParameters,
ReleaseParameters,
MemoryParameters,
MemoryArea,
ReleaseRunner,
Consumer)
with arguments (scheduling, release, null, null, null, null)
StaticIllegalArgumentException
public AsyncObjectEventHandler(Consumer<P> logic)
AsyncObjectEventHandler(SchedulingParameters,
ReleaseParameters,
MemoryParameters,
MemoryArea,
ReleaseRunner,
Consumer)
with arguments (null, null, null, null, null, null, logic)
.public AsyncObjectEventHandler()
AsyncObjectEventHandler
(AOEH) with default
values for all parameters.public void handleAsyncEvent(P 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 either invokes the
run
method of the logic
passed to the
constructor of this handler, when it is an instance of
Runnable
or nothing, when logic
is null
.
This AOEH is a source of reference for its initial memory area while this AOEH is released.
All throwables from (or propagated through)
handleAsyncEvent(P)
are caught, a stack trace is printed
and execution continues as if handleAsyncEvent(P)
had
returned normally.
payload
- The data associated with the release being handled.public P peekPending() throws StaticIllegalStateException
StaticIllegalStateException
- when the fire count is zero.handleAsyncEvent(P)
}.aicas GmbH, Karlsruhe, Germany —www.aicas.com
Copyright © 2001-2021 aicas GmbH. All Rights Reserved.