|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.realtime.AsyncEvent
public class AsyncEvent
An asynchronous event can have a set of handlers associated with it, and
when the event occurs, the fireCount
of each handler is incremented, and the
handlers are released (see AsyncEventHandler
).
Constructor Summary | |
---|---|
AsyncEvent()
Create a new AsyncEvent object. |
Method Summary | |
---|---|
void |
addHandler(AsyncEventHandler handler)
Add a handler to the set of handlers associated with this event. |
void |
bindTo(java.lang.String happening)
Binds this to an external event, a happening. |
ReleaseParameters |
createReleaseParameters()
Create a ReleaseParameters object appropriate to the release characteristics
of this event. |
void |
fire()
Fire this instance of AsyncEvent . |
boolean |
handledBy(AsyncEventHandler handler)
Test to see if the handler given as the parameter is associated with this . |
void |
removeHandler(AsyncEventHandler handler)
Remove a handler from the set associated with this event. |
void |
setHandler(AsyncEventHandler handler)
Associate a new handler with this event and remove all existing handlers. |
void |
unbindTo(java.lang.String happening)
Removes a binding to an external event, a happening. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AsyncEvent()
AsyncEvent
object.
Method Detail |
---|
public void addHandler(AsyncEventHandler handler)
AsyncEvent
may have more than one associated handler. However, adding a handler
to an event has no effect if the handler is already attached to the event.
The execution of this method is atomic with respect
to the execution of the fire()
method.
Since this affects the constraints expressed in the release parameters of an existing schedulable object, this may change the feasibility of the current system. This method does not change feasibility set of any scheduler, and no feasibility test is performed.
Note, there is an implicit reference to the handler stored in this
.
The assignment must be valid under any applicable memory assignment rules.
handler
- The new handler to add to the list of handlers already
associated with this.
If the handler
is already associated with
the event, the call has no effect.
java.lang.IllegalArgumentException
- Thrown if handler
is null.public void removeHandler(AsyncEventHandler handler)
fire()
method.
A removed handler continues to execute until its fireCount becomes zero and it completes.
Since this affects the constraints expressed in the release parameters of an existing schedulable object, this may change the feasibility of the current system. This method does not change the feasibility set of any scheduler, and no feasibility test is performed.
handler
- The handler to be disassociated from this
.
If null nothing happens. If the handler
is not already
associated with this
then nothing happens.public boolean handledBy(AsyncEventHandler handler)
this
.
handler
- The handler to be tested to determine if it is
associated with this
.
this
.
False if handler
is null or the parameters is not associated with this
.public void setHandler(AsyncEventHandler handler)
fire()
method.
Since this affects the constraints expressed in the release parameters of the existing schedulable objects, this may change the feasibility of the current system. This method does not change the feasibility set of any scheduler, and no feasibility test is performed.
handler
- The new instance of AsyncEventHandler
to be associated with this
.
If handler
is null then no handler will be associated with this
(i.e., remove all handlers).public ReleaseParameters createReleaseParameters()
ReleaseParameters
object appropriate to the release characteristics
of this event. The default is the most pessimistic: AperiodicParameters
.
This is typically called by code that is setting up a handler for this event
that will fill in the parts of the release parameters for which it has values,
e.g., cost. The returned ReleaseParameters
object is not bound to the event.
Any changes in the event's release parameters are not reflected in previously
returned objects.
If an event returns PeriodicParameters
, there is no requirement
for an implementation to check that the handler is released periodically.
ReleaseParameters
object.public void bindTo(java.lang.String happening)
happening
are implementation dependent. This
instance of AsyncEvent
is considered to have occurred whenever
the happening is triggered. More than one happening can be bound to
the same AsyncEvent
. However, binding a happening to an event
has no effect if the happening is already bound to the event.
When an event, which is declared in a scoped memory area, is bound to an external happening, the reference count of that scoped memory area is incremented (as if there is an external real-time thread accessing the area). The reference count is decremented when the event is unbound from the happening.
happening
- An implementation dependent value that binds
this instance of AsyncEvent
to a happening.
UnknownHappeningException
- Thrown if the String value is not
supported by the implementation.
java.lang.IllegalArgumentException
- Thrown if happening
is null.public void unbindTo(java.lang.String happening)
happening
are implementation dependent. If the associated
event is declared in a scoped memory area, the reference count for the memory area
is decremented.
happening
- An implementation dependent value representing some
external event to which this instance of AsyncEvent
is bound.
UnknownHappeningException
- Thrown if this instance of
AsyncEvent
is
not bound to the given happening
or the given happening
is not supported by the implementation.
java.lang.IllegalArgumentException
- Thrown if happening
is null.public void fire()
AsyncEvent
.
The asynchronous event handlers associated with
this event will be released.
If no handlers are attached then the method does nothing.
An AsyncEvent
that has been
bound to an external happening can still be fired by the application code.
AsyncEvent
has more than one instance of
AsyncEventHandler
with release parameters object of type
AperiodicParameters
attached and the execution of
AsyncEvent.fire()
introduces the requirement to throw at least
one type of exception, then all instances of AsyncEventHandler
not affected by the exception are handled normally.
AsyncEvent
has more than one instance
of AsyncEventHandler
with release parameters object of
type SporadicParameters
attached and the execution of
AsyncEvent.fire()
introduces the simultaneous requirement
to throw more than one type of exception or error then
MITViolationException
has precedence over
ArrivalTimeQueueOverflowException
.
MITViolationException
- Thrown if there is a handler associated
with this event that has its MIT violated by the call to fire
(and it has set the minimum inter-arrival time violation behavior
to MITViolationExcept). Only the handlers which do not have their MITs violated are
released in this situation.
ArrivalTimeQueueOverflowException
- Thrown if the queue of arrival time
information overflows. Only the handlers which do not cause this exception to be thrown are
released in this situation.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |