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 a
Long
payload with each fire. |
Modifier and Type | Method and Description |
---|---|
protected int |
getAndClearPendingFireCount()
getAndClearPendingFireCount sets the pending fire count to zero
and returns the original value.
|
protected int |
getAndDecrementPendingFireCount()
getAndDecrementPendingFireCount decrements the pending fire count
and returns the original value.
|
protected int |
getPendingFireCount()
getPendingFireCount returns the current number of pending
invocations to handleAsyncEvent().
|
void |
handleAsyncEvent(P value)
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.
|
void |
run()
When an object implementing interface
Runnable is used
to create a thread, starting the thread causes the object's
run method to be called in that separately executing
thread. |
addIfFeasible, addToFeasibility, finalize, getAndIncrementPendingFireCount, getDispatcher, getMemoryArea, getMemoryParameters, getProcessingGroupParameters, getReleaseParameters, getScheduler, getSchedulingParameters, isDaemon, removeFromFeasibility, setDaemon, setIfFeasible, setIfFeasible, setIfFeasible, setIfFeasible, setIfFeasible, setMemoryParameters, setMemoryParametersIfFeasible, setProcessingGroupParameters, setProcessingGroupParametersIfFeasible, setReleaseParameters, setReleaseParametersIfFeasible, setScheduler, setScheduler, setSchedulingParameters, setSchedulingParametersIfFeasible
public AsyncObjectEventHandler(SchedulingParameters scheduling, ReleaseParameters release, MemoryParameters memory, MemoryArea area, ReleaseRunner runner, Consumer<P> logic) throws StaticIllegalArgumentException
Long
payload with each fire.StaticIllegalArgumentException
- when the event queue
overflow policy is QueueOverflowPolicy.DISABLE
.StaticUnsupportedOperationException
- every time, since it is
not implemented yet.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)
.StaticUnsupportedOperationException
- every time, since it is
not implemented yet.StaticIllegalArgumentException
public AsyncObjectEventHandler(SchedulingParameters scheduling, ReleaseParameters release) throws StaticIllegalArgumentException
AsyncObjectEventHandler(SchedulingParameters,
ReleaseParameters,
MemoryParameters,
MemoryArea,
ReleaseRunner,
Consumer)
with arguments (scheduling, release, null, null, null, null)
StaticUnsupportedOperationException
- every time, since it is
not implemented yet.StaticIllegalArgumentException
public AsyncObjectEventHandler(Consumer<P> logic)
AsyncObjectEventHandler(SchedulingParameters,
ReleaseParameters,
MemoryParameters,
MemoryArea,
ReleaseRunner,
Consumer)
with arguments (null, null, null, null, null, null, logic)
.StaticUnsupportedOperationException
- every time, since it is
not implemented yet.logic
- It is the function to call on the object received.public AsyncObjectEventHandler()
AsyncObjectEventHandler
(AOEH) with default
values for all parameters.StaticUnsupportedOperationException
- every time, since it is not implemented yetAsyncObjectEventHandler(SchedulingParameters,
ReleaseParameters,
MemoryParameters,
MemoryArea,
ReleaseRunner,
Consumer)
public void handleAsyncEvent(P value)
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 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.
StaticUnsupportedOperationException
- every time, since it is not implemented yetpublic P peekPending() throws StaticIllegalStateException
StaticIllegalStateException
- when the fire count is zero.handleAsyncEvent(P)
}.public final void run()
Runnable
Runnable
is used
to create a thread, starting the thread causes the object's
run
method to be called in that separately executing
thread.
The general contract of the method run
is that it may
take any action whatsoever.
UnsupportedOperationException
- every time, since it is not implemented yetThread.run()
protected int getPendingFireCount()
AsyncBaseEventHandler
getPendingFireCount
in class AsyncBaseEventHandler
StaticUnsupportedOperationException
- every time, since it is not implemented yetprotected int getAndDecrementPendingFireCount()
AsyncBaseEventHandler
getAndDecrementPendingFireCount
in class AsyncBaseEventHandler
StaticUnsupportedOperationException
- every time, since it is not implemented yetprotected int getAndClearPendingFireCount()
AsyncBaseEventHandler
getAndClearPendingFireCount
in class AsyncBaseEventHandler
StaticUnsupportedOperationException
- every time, since it is not implemented yetaicas GmbH, Karlsruhe, Germany —www.aicas.com
Copyright © 2001-2019 aicas GmbH. All Rights Reserved.