D - The type of dispatcher this class is.T - The type of event to be dispatched.public abstract class ActiveEventDispatcher<D extends ActiveEventDispatcher<D,T>,T extends Releasable<T,D>>
extends java.lang.Object
ActiveEvents. It
acts as if it contains a daemon RealtimeThread to perform this task. The
priority of this thread can be specified when a dispatcher object is
created. The default dispatcher runs at the highest realtime
priority on the base scheduler. Dispatchers do not maintain a queue of
pending event.
Application code cannot extend this class.
| Modifier | Constructor and Description |
|---|---|
protected |
ActiveEventDispatcher(RealtimeThread thread)
Creates a new dispatcher.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
activate(T event)
Activate an active event registered with this
dispatcher.
|
protected void |
deactivate(T event)
Deactivate an active event registered with this dispatcher.
|
protected abstract void |
deregister(T event)
Deregisters an active event from this dispatcher, breaking its
association with this dispatcher.
|
abstract void |
destroy()
Makes the dispatcher unusable.
|
RealtimeThreadGroup |
getRealtimeThreadGroup()
Determines in which group the thread associated with this dispatcher is.
|
Scheduler |
getScheduler()
Gets a reference to the
Scheduler object for this
schedulable. |
SchedulingParameters |
getSchedulingParameters()
Determines how the thread associated with this dispatcher is scheduled.
|
protected RealtimeThread |
getThread()
Obtain the thread behind the dispatcher.
|
abstract boolean |
isRegistered(T event)
Test wether or not a given event is registered with this
dispatcher.
|
protected abstract void |
register(T event)
Registers an active event with this dispatcher.
|
ActiveEventDispatcher<D,T> |
setScheduler(Scheduler scheduler)
Sets the reference to the Scheduler object.
|
ActiveEventDispatcher<D,T> |
setScheduler(Scheduler scheduler,
SchedulingParameters scheduling)
Sets the scheduler and associated parameter objects.
|
ActiveEventDispatcher<D,T> |
setSchedulingParameters(SchedulingParameters scheduling)
Sets the scheduling parameters associated with this instance of
Schedulable. |
protected ActiveEventDispatcher(RealtimeThread thread) throws StaticIllegalStateException
thread - a realtime thread set up to run the dispatcher.StaticIllegalArgumentException - thread is null.StaticIllegalStateExceptionpublic Scheduler getScheduler()
Scheduler object for this
schedulable.Scheduler object.public ActiveEventDispatcher<D,T> setScheduler(Scheduler scheduler) throws IllegalTaskStateException
scheduler. If the
Schedulable is running, its associated
SchedulingParameters (if any) must be compatible with
scheduler.scheduler - A reference to the scheduler that will manage
execution of this schedulable. Null is
not a permissible value.thisStaticIllegalArgumentException - when scheduler
is null, or the schedulable's existing
parameter values are not compatible with
scheduler. Also when this schedulable
may not use the heap and scheduler is located in heap
memory.IllegalAssignmentError - when the schedulable cannot
hold a reference to scheduler or the current
Schedulable is running and its associated
SchedulingParameters are incompatible with
scheduler.StaticSecurityException - when the caller is not permitted to set
the scheduler for this schedulable.IllegalTaskStateException - when scheduler
has scheduling or release parameters that are not compatible
with the new scheduler and this schedulable is running.public ActiveEventDispatcher<D,T> setScheduler(Scheduler scheduler, SchedulingParameters scheduling) throws StaticSecurityException, IllegalTaskStateException
scheduler.scheduler - A reference to the scheduler that will manage the
execution of this schedulable. Null is
not a permissible value.scheduling - A reference to the SchedulingParameters
which will be associated with this. When
null, the default value is governed by
scheduler; a new object is created when the
default value is not null. (See PriorityScheduler.)thisStaticIllegalArgumentException - when scheduler
is null or the parameter values are not
compatible with scheduler. Also thrown when
this schedulable may not use the heap and
scheduler, scheduling
release, memoryParameters, or
group is located in heap memory.IllegalAssignmentError - when this object cannot
hold references to all the parameter objects or the
parameters cannot hold references to this.StaticSecurityException - when the caller is not permitted to set
the scheduler for this schedulable.IllegalTaskStateExceptionpublic SchedulingParameters getSchedulingParameters()
public ActiveEventDispatcher<D,T> setSchedulingParameters(SchedulingParameters scheduling) throws IllegalTaskStateException, IllegalAssignmentError, StaticIllegalArgumentException
Schedulable.
This change becomes effective under conditions determined by the scheduler controlling the schedulable. For instance, the change may be immediate or it may be delayed until the next release of the schedulable. See the documentation for the scheduler for details.
scheduling - A reference to the SchedulingParameters
object. When null, the default value is governed
by the associated scheduler; a new object is created when the
default value is not null. (See
PriorityScheduler.)thisStaticIllegalArgumentException - when scheduling is
not compatible with the associated scheduler or when
scheduling is null. Also when this
schedulable may not use the heap and scheduling is
located in heap memory.IllegalAssignmentError - when this object cannot hold
a reference to scheduling or scheduling
cannot hold a reference to this.IllegalTaskStateException - when the task is active and the
new scheduling parameters are not compatible with the
current scheduler or the affinity in scheduling is
invalid or not a subset of the affinity of this object's
realtime thread group.public RealtimeThreadGroup getRealtimeThreadGroup()
protected RealtimeThread getThread()
public abstract boolean isRegistered(T event)
event - The event to testtrue when event is registered with this
dispatcher.protected abstract void register(T event) throws RegistrationException, StaticIllegalStateException
event - The event to registerRegistrationException - when event is already
registered.StaticIllegalStateException - when this object has been destroyed.protected void activate(T event) throws RegistrationException, StaticIllegalArgumentException
event - The event to registerRegistrationException - when event is not already
registered.StaticIllegalStateException - when event is
stopped.StaticIllegalArgumentExceptionprotected abstract void deregister(T event) throws RegistrationException, StaticIllegalStateException
event - The event to deregisterStaticIllegalStateException - when this object has been
destroyedStaticIllegalArgumentException - when event is not
stopped or is null.RegistrationExceptionprotected void deactivate(T event) throws DeregistrationException, StaticIllegalStateException, StaticIllegalArgumentException
event - The event to deregisterDeregistrationException - when event is not already
registered.StaticIllegalStateException - when this object has been destroyed.StaticIllegalArgumentException - when event is not
stopped or is null.public abstract void destroy()
throws StaticIllegalStateException
StaticIllegalStateException - when called on a dispatcher that has
one or more registered objects.aicas GmbH, Karlsruhe, Germany —www.aicas.com
Copyright © 2001-2024 aicas GmbH. All Rights Reserved.