public class AsyncEventHandler extends AsyncBaseEventHandler implements Schedulable
An instance of this class contains code that will be released for execution when an asynchronous event (AsyncEvent) occurs.
If an event occurs multiple times, the releases of one event handler will be serialized, i.e., one event handler will never be released more than once simultaneously. However, one event that is attached to several handlers can cause the simultaneous release of several event handlers.
If the release parameters associated with this handler are SporadicParameters, then the minimum interarrival time specified in these parameters will be enforced.
The deadline specified is always relative to the fire time, even if the actual release time may be later to enforce the minimum interarrival time.
Handlers run in the context of a RealtimeThread, they may run for
short or long times and they may block. Note that a handler that is
blocked may block all other handlers with the same scheduling
parameters since these handlers may share one instance of
RealtimeThread. A handler may not call
RealtimeThread.waitForNextPeriod()
.
Several handlers share a common set of RealtimeThreads for their
execution. This causes some additional overhead when releasing a
handler and it may cause a delayed execution if a handler with
equal scheduling parameters is blocked during execution. To avoid
these delays, handlers of class BoundAsyncEventHandler
may be used,
these handlers are bound to their own RealtimeThread for execution,
but they require more system resources (threads and
memory).
AsyncEventHandlers may make use of memory areas exactly as RealtimeThreads do.
Constructor and Description |
---|
AsyncEventHandler()
Constructor to create an instance of AsyncEventHandler with
default parameters.
|
AsyncEventHandler(boolean noheap)
Deprecated.
since RTSJ 2.0
|
AsyncEventHandler(boolean noheap,
Runnable logic)
Deprecated.
since RTSJ 2.0
|
AsyncEventHandler(Runnable logic)
Constructor to create an instance of AsyncEventHandler with
default parameters and the specified value for the logic
parameter.
|
AsyncEventHandler(SchedulingParameters scheduling,
ReleaseParameters<?> release) |
AsyncEventHandler(SchedulingParameters scheduling,
ReleaseParameters<?> release,
MemoryParameters memory,
MemoryArea area,
ConfigurationParameters config,
ReleaseRunner runner,
Runnable logic) |
AsyncEventHandler(SchedulingParameters scheduling,
ReleaseParameters<?> release,
MemoryParameters memory,
MemoryArea area,
ProcessingGroupParameters pgp,
boolean noheap)
Deprecated.
since RTSJ 2.0
|
AsyncEventHandler(SchedulingParameters scheduling,
ReleaseParameters<?> release,
MemoryParameters memory,
MemoryArea area,
ProcessingGroupParameters pgp,
boolean noheap,
Runnable logic)
Deprecated.
since RTSJ 2.0
|
AsyncEventHandler(SchedulingParameters scheduling,
ReleaseParameters<?> release,
MemoryParameters memory,
MemoryArea area,
ProcessingGroupParameters pgp,
Runnable logic)
Deprecated.
since RTSJ 2.0
|
AsyncEventHandler(SchedulingParameters scheduling,
ReleaseParameters<?> release,
MemoryParameters memory,
MemoryArea area,
Runnable logic) |
AsyncEventHandler(SchedulingParameters scheduling,
ReleaseParameters<?> release,
Runnable logic) |
Modifier and Type | Method and Description |
---|---|
boolean |
addIfFeasible()
Deprecated.
as of RTSJ 2.0, because the framework for feasibility
analysis is inadequate.
|
boolean |
addToFeasibility()
Deprecated.
as of RTSJ 2.0, because the framework for feasibility
analysis is inadequate.
|
protected int |
getAndIncrementPendingFireCount()
Deprecated.
as of RTSJ 2.0 Use ae.fire()
|
ProcessingGroupParameters |
getProcessingGroupParameters()
Deprecated.
as of RTSJ 2.0, because the framework for feasibility
analysis is inadequate.
|
void |
handleAsyncEvent()
handleAsyncEvent should be overwritten to contain the code to be
executed whenever this event is released.
|
void |
release()
Release this handler now.
|
boolean |
removeFromFeasibility()
Deprecated.
as of RTSJ 2.0, because the framework for feasibility
analysis is inadequate.
|
boolean |
setIfFeasible(ReleaseParameters<?> release,
MemoryParameters memory)
Deprecated.
as of RTSJ 2.0, because the framework for feasibility
analysis is inadequate.
|
boolean |
setIfFeasible(ReleaseParameters<?> release,
MemoryParameters memory,
ProcessingGroupParameters pgp)
Deprecated.
as of RTSJ 2.0, because the framework for feasibility
analysis is inadequate.
|
boolean |
setIfFeasible(ReleaseParameters<?> release,
ProcessingGroupParameters pgp)
Deprecated.
as of RTSJ 2.0, because the framework for feasibility
analysis is inadequate.
|
boolean |
setIfFeasible(SchedulingParameters sched,
ReleaseParameters<?> release,
MemoryParameters memory)
Deprecated.
as of RTSJ 2.0, because the framework for feasibility
analysis is inadequate.
|
boolean |
setIfFeasible(SchedulingParameters sched,
ReleaseParameters<?> release,
MemoryParameters memory,
ProcessingGroupParameters pgp)
Deprecated.
as of RTSJ 2.0, because the framework for feasibility
analysis is inadequate.
|
boolean |
setMemoryParametersIfFeasible(MemoryParameters memory)
Deprecated.
as of RTSJ 2.0, because the framework for feasibility
analysis is inadequate.
|
void |
setProcessingGroupParameters(ProcessingGroupParameters pgp)
Deprecated.
as of RTSJ 2.0, because the framework for feasibility
analysis is inadequate.
|
boolean |
setProcessingGroupParametersIfFeasible(ProcessingGroupParameters pgp)
Deprecated.
as of RTSJ 2.0, because the framework for feasibility
analysis is inadequate.
|
Schedulable |
setReleaseParameters(ReleaseParameters<?> release)
setReleaseParameters replaces the release parameters for this
handler with the parameters provided.
|
boolean |
setReleaseParametersIfFeasible(ReleaseParameters<?> release)
Deprecated.
as of RTSJ 2.0, because the framework for feasibility
analysis is inadequate.
|
void |
setScheduler(Scheduler scheduler,
SchedulingParameters scheduling,
ReleaseParameters<?> release,
MemoryParameters memory,
ProcessingGroupParameters pgp)
Deprecated.
since RTSJ 2.0
|
boolean |
setSchedulingParametersIfFeasible(SchedulingParameters scheduling)
Deprecated.
as of RTSJ 2.0, because the framework for feasibility
analysis is inadequate.
|
getAndClearPendingFireCount, getAndDecrementPendingFireCount, getConfigurationParameters, getCurrentReleaseTime, getCurrentReleaseTime, getMemoryArea, getMemoryParameters, getPendingFireCount, getQueueLength, getReleaseParameters, getReleaseRunner, getScheduler, getSchedulingParameters, isArmed, isDaemon, mayUseHeap, run, setDaemon, setMemoryParameters, setScheduler, setScheduler, setSchedulingParameters, subsumes
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getConfigurationParameters, getMemoryParameters, getReleaseParameters, getScheduler, getSchedulingParameters, isDaemon, mayUseHeap, setDaemon, setMemoryParameters, setScheduler, setScheduler, setSchedulingParameters, subsumes
public AsyncEventHandler()
public AsyncEventHandler(Runnable logic)
logic
- the logic to executed or null.@Deprecated public AsyncEventHandler(SchedulingParameters scheduling, ReleaseParameters<?> release, MemoryParameters memory, MemoryArea area, ProcessingGroupParameters pgp, Runnable logic)
scheduling
- SchedulingParameters to be associated with the new
async event handler. This can be shared with several Schedulable
objects. If it is null, a copy of the creator's value will be
created in the same memory area as this AEH object. If it is null
and the current thread is a normal Java thread, the scheduling
parameters will be set to the default priority.release
- ReleaseParameters to be associated with the new async
event handler. This can be shared with several Schedulable
objects. If it is null, default release parameters will be used.memory
- MemoryParameters to be associated with the new
thread. May be null for unrestricted amount and rate of memory
allocation for the new AEH.area
- MemoryArea to be used by the new AEH. If it is null,
the current memory area of the calling thread will be used.pgp
- ProcessingGroupParameters to be associated with
this. This can be shared with several Schedulable objects. If it
is null, this will not be associated with any processing group.@Deprecated public AsyncEventHandler(boolean noheap)
noheap
- true to create an AsyncEventHandler that runs in a
NoHeapRealtimeThread.@Deprecated public AsyncEventHandler(boolean noheap, Runnable logic)
noheap
- true to create an AsyncEventHandler that runs in a
NoHeapRealtimeThread.logic
- the logic to executed or null.@Deprecated public AsyncEventHandler(SchedulingParameters scheduling, ReleaseParameters<?> release, MemoryParameters memory, MemoryArea area, ProcessingGroupParameters pgp, boolean noheap)
scheduling
- SchedulingParameters to be associated with the new
async event handler. This can be shared with several Schedulable
objects. If it is null, a copy of the creator's value will be
created in the same memory area as this AEH object. If it is null
and the current thread is a normal Java thread, the scheduling
parameters will be set to the default priority.release
- ReleaseParameters to be associated with the new
AsyncEventHandler. This can be shared with several Schedulable
objects. If it is null, default release parameters will be used.memory
- MemoryParameters to be associated with new
thread. May be null for unrestricted amount and rate of memory
allocation for the new AEH.area
- MemoryArea to be used by the new AEH. If it is null,
the current memory area of the calling thread will be used.pgp
- ProcessingGroupParameters to be associated with
this. This can be shared with several Schedulable objects. If it
is null, this will not be associated with any processing group.noheap
- true to create an AsyncEventHandler that runs in a
NoHeapRealtimeThread.@Deprecated public AsyncEventHandler(SchedulingParameters scheduling, ReleaseParameters<?> release, MemoryParameters memory, MemoryArea area, ProcessingGroupParameters pgp, boolean noheap, Runnable logic)
StaticIllegalArgumentException
- iff scheduling or release
parameters are not compatible with the default scheduler, i.e.,
iff they are non-null and not an instance of PriorityParameters
or PeriodicParameters, AperiodicParameters and
SporadicParameters, respectively.IllegalAssignmentError
- if scheduling, release, memory,
area, group, or logic reside in memory areas whose objects cannot
be referred to by this or this object resides in a memory area that
cannot be referenced by scheduling, release, or memory.scheduling
- SchedulingParameters to be associated with the new
AsyncEventHandler. This can be shared with several Schedulable
objects. If it is null, a copy of the creator's value will be
created in the same memory area as this AEH object. If it is null
and the current thread is a normal Java thread, the scheduling
parameters will be set to the default priority.release
- ReleaseParameters to be associated with the new
AsyncEventHandler. This can be shared with several Schedulable
objects. If it is null, default release parameters will be used.memory
- MemoryParameters to be associated with the new
thread. May be null for unrestricted amount and rate of memory
allocation for the new AEH.area
- MemoryArea to be used by the new AEH. If it is null,
the current memory area of the calling thread will be used.pgp
- ProcessingGroupParameters to be associated with
this. This can be shared with several Schedulable objects. If it
is null, this will not be associated with any processing group.noheap
- true to create an AsyncEventHandler that runs in a
NoHeapRealtimeThread.logic
- Runnable to be used as the logic for this. If is is
null, the run() method in this new AsyncEventHandler object will be
called when the thread is started.public AsyncEventHandler(SchedulingParameters scheduling, ReleaseParameters<?> release)
public AsyncEventHandler(SchedulingParameters scheduling, ReleaseParameters<?> release, Runnable logic)
public AsyncEventHandler(SchedulingParameters scheduling, ReleaseParameters<?> release, MemoryParameters memory, MemoryArea area, Runnable logic)
public AsyncEventHandler(SchedulingParameters scheduling, ReleaseParameters<?> release, MemoryParameters memory, MemoryArea area, ConfigurationParameters config, ReleaseRunner runner, Runnable logic)
public void handleAsyncEvent()
This method will be called repeatedly while fireCount_ is greater than zero, the fireCount_ will be reduced by one after each call.
Any throwable thrown by this method will be caught, the stack trace will be printed and the exception will be ignored.
public Schedulable setReleaseParameters(ReleaseParameters<?> release) throws IllegalThreadStateException
AsyncBaseEventHandler
setReleaseParameters replaces the release parameters for this handler with the parameters provided.
This change may change the feasibility of the current feasible set of this handler's scheduler.
setReleaseParameters
in interface Schedulable
setReleaseParameters
in class AsyncBaseEventHandler
IllegalThreadStateException
- If the old release parameters
are periodic, the new release parameters are not periodic, and the
schedulable object is currently blocked in waitForNextPeriod or
waitForNextPeriodInterruptible.release
- the new release parameters. If null, the default
value for the associated scheduler will be used.@Deprecated protected int getAndIncrementPendingFireCount() throws MITViolationException, ArrivalTimeQueueOverflowException
fireCount_
.
This method atomically increments, by one, the value of
fireCount_
and returns the value from before the
increment.
Calling this method is effectively the same as firing an event that is associated with this handler. When called from outside the handler's control flow, call it is effectively the same as firing an event that is associated with this handler, except that it does not constitute a release event.
MITViolationException
- when this AEH is controlled by
sporadic scheduling parameters under the base scheduler,
the parameters specify the mitViolationExcept
policy, and this method would introduce a release that
would violate the specified minimum interarrival time.ArrivalTimeQueueOverflowException
- when this AEH is
controlled by aperiodic scheduling parameters under the
base scheduler, the release parameters specify the
arrivalTimeQueueOverflowExcept
policy, and
this method would cause the arrival time queue to overflow.fireCount_
prior to
incrementing it by one.public void release() throws MITViolationException, ArrivalTimeQueueOverflowException
MITViolationException
- iff the minimum interarrival time
was not respected and the MIT-violation behavior is set to EXCEPT.ArrivalTimeQueueOverflowException
- if an overflow in the
arrival time queue occurred and the arrival time queue overflow
behavior is EXCEPT.@Deprecated public void setScheduler(Scheduler scheduler, SchedulingParameters scheduling, ReleaseParameters<?> release, MemoryParameters memory, ProcessingGroupParameters pgp) throws StaticIllegalArgumentException, IllegalAssignmentError, IllegalThreadStateException, SecurityException
The change of the scheduler and the scheduling and memory parameters will be immediate for the default scheduler. release, and processing group parameters will take effect on the next release.
This change may change the feasibility of the current feasible set of this handler's scheduler.
StaticIllegalArgumentException
- if scheduler is null or the
scheduling, release, memory, or processing group parameters are
not compatible with the scheduler.IllegalAssignmentError
- if scheduler, scheduling, release,
memory, or group reside in memory areas whose objects cannot be
referred to by this or this object resides in a memory area that
cannot be referenced by scheduling, release, or memory.IllegalThreadStateException
- If the old release parameters
are periodic, the new release parameters are not periodic and the
schedulable object is currently blocked in waitForNextPeriod or
waitForNextPeriodInterruptible.SecurityException
- if setting of the scheduler is not
allowed by the current RealtimeSystem setting.scheduler
- The scheduler to be used for this handler. Must
not be null.scheduling
- SchedulingParameters to be associated with the
handler. If null, the default value of the scheduler will
be used.release
- the new release parameters. If null, the default
value for the associated scheduler will be used.memory
- the new memory parameters. If null, the default
value for the associated scheduler will be used.pgp
- the new processing group parameters to be applied
for the next release of this. If null, the default value for
the scheduler will be used.@Deprecated public ProcessingGroupParameters getProcessingGroupParameters()
AsyncEventHandler
.getProcessingGroupParameters
in interface Schedulable
@Deprecated public void setProcessingGroupParameters(ProcessingGroupParameters pgp)
In JamaicaVM, this change becomes effective immediately.
This change may change the feasibility of the current feasible
set of this AsyncEventHandler
's scheduler.
setProcessingGroupParameters
in interface Schedulable
StaticIllegalArgumentException
- if the pgp argument is not
compatible with the scheduler of this RealtimeThread.pgp
- the new processing group parameters to be applied
for the next release of this. If null, use the default value for
the scheduler.@Deprecated public boolean addIfFeasible()
If the object is already included in the feasible set, do nothing.
@Deprecated public boolean setIfFeasible(ReleaseParameters<?> release, MemoryParameters memory) throws StaticIllegalArgumentException, IllegalAssignmentError, IllegalThreadStateException
If this object is not a member of the feasible set of the scheduler and the resulting system is feasible, this will be added to the set.
StaticIllegalArgumentException
- if the parameter values are not
compatible with the scheduler associated to this AsyncEventHandler
.IllegalAssignmentError
- if release or memory and this
reside in memory areas whose objects cannot refer to one another
(in both directions).IllegalThreadStateException
- If the old release parameters
are periodic, the new release parameters are not periodic, and the
schedulable object is currently blocked in waitForNextPeriod or
waitForNextPeriodInterruptible.release
- the new release parameters. If null, the default
value for the associated scheduler will be used.memory
- the new memory parameters. If null, the default
value for the associated scheduler will be used.@Deprecated public boolean setIfFeasible(SchedulingParameters sched, ReleaseParameters<?> release, MemoryParameters memory) throws StaticIllegalArgumentException, IllegalAssignmentError, IllegalThreadStateException
If this object is not a member of the feasible set of the scheduler and the resulting system is feasible, this will be added to the set.
StaticIllegalArgumentException
- if the parameter values are not
compatible with the scheduler associated to this AsyncEventHandler
.IllegalAssignmentError
- if sched, release or memory and
this reside in memory areas whose objects cannot refer to one
another (in both directions).IllegalThreadStateException
- If the old release parameters
are periodic, the new release parameters are not periodic, and the
schedulable object is currently blocked in waitForNextPeriod or
waitForNextPeriodInterruptible.sched
- the new scheduling parameters. If null, the default
value of the associated scheduler will be used. This
default value may be null.release
- the new release parameters. If null, the default
value for the associated scheduler will be used.memory
- the new memory parameters. If null, the default
value for the associated scheduler will be used.@Deprecated public boolean setIfFeasible(ReleaseParameters<?> release, MemoryParameters memory, ProcessingGroupParameters pgp) throws StaticIllegalArgumentException, IllegalAssignmentError, IllegalThreadStateException
If this object is not a member of the feasible set of the scheduler and the resulting system is feasible, this will be added to the set.
StaticIllegalArgumentException
- if the parameter values are not
compatible with the scheduler associated to this
AsyncEventHandler
.IllegalAssignmentError
- if release, memory or group and
this reside in memory areas whose objects cannot refer to one
another (in both directions).IllegalThreadStateException
- If the old release parameters
are periodic, the new release parameters are not periodic, and the
schedulable object is currently blocked in waitForNextPeriod or
waitForNextPeriodInterruptible.release
- the new release parameters. If null, the default
value for the associated scheduler will be used.memory
- the new memory parameters. If null, the default
value for the associated scheduler will be used.pgp
- the new processing group parameters. If null, the
default value for the associated scheduler will be used.@Deprecated public boolean setIfFeasible(SchedulingParameters sched, ReleaseParameters<?> release, MemoryParameters memory, ProcessingGroupParameters pgp) throws StaticIllegalArgumentException, IllegalAssignmentError, IllegalThreadStateException
If this object is not a member of the feasible set of the scheduler and the resulting system is feasible, this will be added to the set.
StaticIllegalArgumentException
- if the parameter values are not
compatible with the scheduler associated to this AsyncEventHandler
.IllegalAssignmentError
- if sched, release, memory or group
and this reside in memory areas whose objects cannot refer to one
another (in both directions).IllegalThreadStateException
- If the old release parameters
are periodic, the new release parameters are not periodic, and the
schedulable object is currently blocked in waitForNextPeriod or
waitForNextPeriodInterruptible.sched
- the new scheduling parameters. If null, the default
value of the associated scheduler will be used. This
default value may be null.release
- the new release parameters. If null, the default
value for the associated scheduler will be used.memory
- the new memory parameters. If null, the default
value for the associated scheduler will be used.pgp
- the new processing group parameters. If null, the
default value for the associated scheduler will be used.@Deprecated public boolean setReleaseParametersIfFeasible(ReleaseParameters<?> release) throws IllegalThreadStateException
If this object is not a member of the feasible set of the scheduler and the resulting system is feasible, this will be added to the set.
StaticIllegalArgumentException
- if the parameter values are not
compatible with the scheduler associated to this
AsyncEventHandler
.IllegalAssignmentError
- if release and this reside in
memory areas whose objects cannot refer to one another (in both
directions).IllegalThreadStateException
- If the old release parameters
are periodic, the new release parameters are not periodic, and the
schedulable object is currently blocked in waitForNextPeriod or
waitForNextPeriodInterruptible.release
- the new release parameters. If null, the default
value for the associated scheduler will be used.@Deprecated public boolean setProcessingGroupParametersIfFeasible(ProcessingGroupParameters pgp)
If this object is not a member of the feasible set of the scheduler and the resulting system is feasible, this will be added to the set.
StaticIllegalArgumentException
- if the group parameter value is
not compatible with the scheduler associated to this
AsyncEventHandler
.IllegalAssignmentError
- If group and this reside in memory
areas whose objects cannot refer to one another (in both
directions).pgp
- the new processing group parameters. If null, the
default value for the associated scheduler will be used.@Deprecated public boolean setIfFeasible(ReleaseParameters<?> release, ProcessingGroupParameters pgp) throws StaticIllegalArgumentException, IllegalAssignmentError, IllegalThreadStateException
If this object is not a member of the feasible set of the scheduler and the resulting system is feasible, this will be added to the set.
StaticIllegalArgumentException
- if the parameter values are not
compatible with the scheduler associated to this
AsyncEventHandler
.IllegalAssignmentError
- if release or group and this
reside in memory areas whose objects cannot refer to one another
(in both directions).IllegalThreadStateException
- If the old release parameters
are periodic, the new release parameters are not periodic, and the
schedulable object is currently blocked in waitForNextPeriod or
waitForNextPeriodInterruptible.release
- the new release parameters. If null, the default
value for the associated scheduler will be used.pgp
- the new processing group parameters. If null, the
default value for the associated scheduler will be used.@Deprecated public boolean setMemoryParametersIfFeasible(MemoryParameters memory)
In JamaicaVM, this change becomes effective immediately.
If this object is not a member of the feasible set of the scheduler and the resulting system is feasible, this will be added to the set.
StaticIllegalArgumentException
- if the memory parameter value is
not compatible with the scheduler associated to this
AsyncEventHandler
.IllegalAssignmentError
- if memory and this reside in
memory areas whose objects cannot refer to one another (in both
directions).memory
- the new memory parameters. If null, the default
value for the associated scheduler will be used.@Deprecated public boolean setSchedulingParametersIfFeasible(SchedulingParameters scheduling)
In JamaicaVM, this change of the scheduling parameters becomes effective immediately for the default PriorityScheduler.
If this object is not a member of the feasible set of the scheduler and the resulting system is feasible, this will be added to the set.
StaticIllegalArgumentException
- if the parameter values are not
compatible with the scheduler associated to this
AsyncEventHandler
.IllegalAssignmentError
- if sched, release, memory or pgp
and this reside in memory areas whose objects cannot refer to one
another (in both directions).scheduling
- the new scheduling parameters. If null, the
default value of the associated scheduler will be
used. This default value may be null.@Deprecated public boolean addToFeasibility()
In case this schedulable object is already part of the feasibility analysis, do nothing.
addToFeasibility
in interface Schedulable
@Deprecated public boolean removeFromFeasibility()
AsyncEventHandler
that this AsyncEventHandler
should no longer be taken into account in the feasibility analysis.removeFromFeasibility
in interface Schedulable
aicas GmbH, Karlsruhe, Germany —www.aicas.com
Copyright © 2001-2025 aicas GmbH. All Rights Reserved.