public final class SignalDispatcher extends ActiveEventDispatcher<SignalDispatcher,Signal>
Signal
s.
An application can provide its own dispatcher, providing the priority for
the internal dispatching thread. This dispatching thread calls the
AsyncEvent.fire()
method on the instance of
Signal
associated with the signal each time its signal is
triggered.
This class requires the following permissions:
Method | Required Action for POSIXPermission |
---|---|
setDefaultDispatcher(javax.realtime.posix.SignalDispatcher) |
system |
Signal
,
POSIXPermission
Constructor and Description |
---|
SignalDispatcher(SchedulingParameters scheduling)
Creates a new dispatcher, whose dispatching thread runs with the given
SchedulingParameters . |
SignalDispatcher(SchedulingParameters scheduling,
RealtimeThreadGroup group)
Creates a new dispatcher, whose dispatching thread runs with the given
SchedulingParameters . |
Modifier and Type | Method and Description |
---|---|
protected void |
activate(Signal target)
Activate an active event registered with this
dispatcher.
|
protected void |
deactivate(Signal target)
Deactivate an active event registered with this dispatcher.
|
protected void |
deregister(Signal target)
Deregisters an active event from this dispatcher, breaking its
association with this dispatcher.
|
void |
destroy()
Releases all resources thereby making the dispatcher unusable.
|
static SignalDispatcher |
getDefaultDispatcher()
Obtain the default dispatcher for signals.
|
boolean |
isRegistered(Signal target)
Test wether or not a given event is registered with this
dispatcher.
|
protected void |
register(Signal target)
Registers an active event with this dispatcher.
|
static void |
setDefaultDispatcher(SignalDispatcher dispatcher)
Sets the system default signal dispatcher.
|
getRealtimeThreadGroup, getScheduler, getSchedulingParameters, getThread, setScheduler, setScheduler, setSchedulingParameters
public SignalDispatcher(SchedulingParameters scheduling, RealtimeThreadGroup group) throws StaticIllegalStateException
SchedulingParameters
.scheduling
- Parameters for scheduling this dispatcher.group
- Container for this dispatcher.StaticIllegalStateException
- when the intersection of affinity
in schedule
and the affinity of group
does not
correspond to a valid affinity.public SignalDispatcher(SchedulingParameters scheduling) throws StaticIllegalStateException
SchedulingParameters
.scheduling
- For scheduling this dispatcher.StaticIllegalStateException
- when the intersection of affinity
in scheduling
and the affinity of group
does not correspond to a valid affinity.public static void setDefaultDispatcher(SignalDispatcher dispatcher)
dispatcher
- An instance to be used when the next signal is started.
When null
, the signal dispatcher is set
to the original system default.public static SignalDispatcher getDefaultDispatcher()
public boolean isRegistered(Signal target)
isRegistered
in class ActiveEventDispatcher<SignalDispatcher,Signal>
target
- The event to testtrue
when event
is registered with this
dispatcher.protected void register(Signal target) throws RegistrationException, StaticIllegalStateException
register
in class ActiveEventDispatcher<SignalDispatcher,Signal>
target
- The event to registerRegistrationException
- when event
is already
registered.StaticIllegalStateException
- when this object has been destroyed.protected void activate(Signal target) throws StaticIllegalStateException
activate
in class ActiveEventDispatcher<SignalDispatcher,Signal>
target
- The event to registerStaticIllegalStateException
- when event
is
stopped.protected void deregister(Signal target) throws DeregistrationException, StaticIllegalStateException
deregister
in class ActiveEventDispatcher<SignalDispatcher,Signal>
target
- The event to deregisterStaticIllegalStateException
- when this object has been
destroyedDeregistrationException
protected void deactivate(Signal target) throws StaticIllegalStateException
deactivate
in class ActiveEventDispatcher<SignalDispatcher,Signal>
target
- The event to deregisterStaticIllegalStateException
- when this object has been destroyed.public void destroy() throws StaticIllegalStateException
destroy
in class ActiveEventDispatcher<SignalDispatcher,Signal>
StaticIllegalStateException
- when called on
a dispatcher that has one or more registered Signal
objects.