public class AsyncEvent extends AsyncBaseEvent
Jamaica Real-Time Specification for Java class AsyncEvent.
An instance of AsyncEvent binds an external event (a happening) to a set of AbstractAsyncEventHandlers. Whenever the external event is fired, the fire count of all event handlers associated with this event will be increased and the handlers will be released.
Constructor and Description |
---|
AsyncEvent()
Constructor constructs a new AsyncEvent that is not bound to any
signal.
|
Modifier and Type | Method and Description |
---|---|
void |
addHandler(AsyncEventHandler handler)
addHandler adds a handler to this event.
|
void |
bindTo(String happening)
bindTo bind this handler to a happening that is identified by a
platform-dependent string.
|
ReleaseParameters<?> |
createReleaseParameters()
createReleaseParameters creates the default release parameters
for this event.
|
void |
fire()
fire this event once.
|
boolean |
handledBy(AsyncEventHandler handler)
handledBy tests if this event is handled by a given handler.
|
void |
removeHandler(AsyncEventHandler handler)
removeHandler removes a handler from this event that was
previously added by addHandler.
|
void |
setHandler(AsyncEventHandler handler)
setHandler removes all handlers from the list of handlers for
this event and adds the given handler.
|
void |
unbindTo(String happening)
unbindTo removes the binding to a certain happening.
|
addHandler, disable, enable, handledBy, hasHandlers, isRunning, removeHandler, setHandler
public AsyncEvent()
public void addHandler(AsyncEventHandler handler)
This method has been replaced in RTSJ 2.0 to support the more generic AsyncBaseEventHandler and is kept for binary compatibility.
public void removeHandler(AsyncEventHandler handler)
This method has been replaced in RTSJ 2.0 to support the more generic AsyncBaseEventHandler and is kept for binary compatibility.
public boolean handledBy(AsyncEventHandler handler)
public void setHandler(AsyncEventHandler handler)
public ReleaseParameters<?> createReleaseParameters()
createReleaseParameters creates the default release parameters for this event. The default implementation creates AperiodicParameters without cost/ deadline and without overrun or miss handler.
createReleaseParameters
in class AsyncBaseEvent
public void bindTo(String happening) throws UnknownHappeningException
bindTo bind this handler to a happening that is identified by a platform-dependent string. Integer numbers 1 through POSIXSignalHandler.MAX_SIGNAL_NR bind this event to the corresponding POSIX event.
When this is allocated in ScopedMemory, then the reference count of MemoryArea.getMemoryArea(this) is incremented until this will be unbound from the happening.
StaticIllegalArgumentException
- if happening is null.UnknownHappeningException
- if happening is not supported.happening
- A platform-dependent string to identify the
happening that causes this event.public void unbindTo(String happening) throws UnknownHappeningException
unbindTo removes the binding to a certain happening.
When this is allocated in ScopedMemory, then the reference count of MemoryArea.getMemoryArea(this) is decremented.
StaticIllegalArgumentException
- if happening is null.UnknownHappeningException
- if happening is not supported
or it was not bound to this event via bindTo().happening
- A platform-dependent string to identify the
happening that causes this event.public void fire() throws MITViolationException, ArrivalTimeQueueOverflowException
fire this event once. All event handlers that were added to this event will be released. If this event is bound to an external happening, it may still be fired manually by a call to this method.
If one or several handlers released by the call to fire cause an ArrivalTimeQueueOverflowException, all the handlers not affected by the exception will still be released normally.
If the release of the handlers requires both, a MITViolationException (due to a handler with SporadicParameters) and an ArrivalTimeQueueOverflowException, this method will throw the MITViolationException.
aicas GmbH, Karlsruhe, Germany —www.aicas.com
Copyright © 2001-2022 aicas GmbH. All Rights Reserved.