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 Object
ActiveEvent
s. 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(SchedulingParameters schedule)
Creates a new dispatcher.
|
protected |
ActiveEventDispatcher(SchedulingParameters schedule,
RealtimeThreadGroup group)
Creates a new dispatcher.
|
Modifier and Type | Method and Description |
---|---|
abstract void |
deregister(T event)
Deregisters an active event from 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.
|
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(SchedulingParameters schedule, RealtimeThreadGroup group) throws StaticIllegalStateException
StaticIllegalStateException
- when the intersection of affinity
in schedule
and the affinity of group
does not
correspond to a valid affinity.schedule
- Provides scheduling information to the new object.group
- The RealtimeThreadGroup
of the thread of this dispatcher.protected ActiveEventDispatcher(SchedulingParameters schedule) throws StaticIllegalArgumentException
StaticIllegalArgumentException
- when the intersection of affinity
in schedule
and the affinity of the current thread group
does not correspond to a valid affinity.schedule
- Provides scheduling information to the new object.public 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
.StaticIllegalArgumentException
- 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.scheduler
- A reference to the scheduler that will manage
execution of this schedulable. Null
is
not a permissible value.this
public ActiveEventDispatcher<D,T> setScheduler(Scheduler scheduler, SchedulingParameters scheduling) throws StaticSecurityException, IllegalTaskStateException
scheduler
.StaticIllegalArgumentException
- 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.IllegalTaskStateException
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
.)this
public 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.
StaticIllegalArgumentException
- 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 intersection of affinity in scheduling
and the affinity of this
object's realtime thread group
is not an valid affinity.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
.)this
public RealtimeThreadGroup getRealtimeThreadGroup()
public abstract void register(T event) throws RegistrationException, StaticIllegalStateException, StaticIllegalArgumentException
RegistrationException
- when event
is already
registered.StaticIllegalStateException
- when this object has been destroyed.StaticIllegalArgumentException
- when event
is not
stopped or is null
.event
- The event to registerpublic abstract void deregister(T event) throws DeregistrationException, StaticIllegalStateException, StaticIllegalArgumentException
DeregistrationException
- when event
is already
registered.StaticIllegalStateException
- when this object has been destroyed.StaticIllegalArgumentException
- when event
is not stopped.event
- The event to deregisterpublic 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-2019 aicas GmbH. All Rights Reserved.