T
- This type parameter specifies the type of the data object which will
be passed each time the signal is triggered.public interface Signal<T>
Modifier and Type | Method and Description |
---|---|
Signal<T> |
makeRestricted()
Convert the signal interface to restricted capability.
|
void |
signal(T data)
Sends a signal event notification.
|
void |
signalFinalize(T data)
Sends a finalising signal event notification.
|
void |
subscribe(Signalable<T> signalable)
Subscribes a new signalable object.
|
void |
subscribe(Signalable<T> signalable,
int priorityLevel)
Subscribes a new signalable object with a specific priority level.
|
void |
unsubscribe(Signalable<T> signalable)
Unsubscribes a signalable object.
|
void subscribe(Signalable<T> signalable) throws SignalContextException, ReactorNotRunningException
signalable
- This is the signalable object which is being subscribed.SignalContextException
- This runtime exception is thrown if there is an attempt to
subscribe a new signalable object from the context of a signal
event callback.ReactorNotRunningException
- This exception is thrown when attempt is made to subscribe to a
signal when the reactor is not running.void subscribe(Signalable<T> signalable, int priorityLevel) throws SignalContextException, ReactorNotRunningException
signalable
- This is the signalable object which is being subscribed.priorityLevel
- This is the priority level which will be used to determine the
notification order for subscribed signalable objects. Signalable
objects with higher priority levels will be notified of signal
events before those with lower priority levels.SignalContextException
- This runtime exception is thrown if there is an attempt to
subscribe a new signalable object from the context of a signal
event callback.ReactorNotRunningException
- This exception is thrown when attempt is made to subscribe to a
signal when the reactor is not running.void unsubscribe(Signalable<T> signalable) throws SignalContextException, ReactorNotRunningException
signalable
- This is the signalable object which is being unsubscribed.SignalContextException
- This runtime exception is thrown if there is an attempt to
unsubscribe a signalable object from the context of a signal
event callback.ReactorNotRunningException
- This exception is thrown when attempt is made to unsubscribe from
a signal when the reactor is not running.void signal(T data) throws RestrictedCapabilityException, ReactorNotRunningException
data
- This is the signal data parameter which will be passed to each
subscribed signalable object in turn. It is good practice to make
this parameter object immutable.RestrictedCapabilityException
- This exception is thrown if an attempt is made to call this
method on a signal event object reference with restricted
capability.ReactorNotRunningException
- This exception is thrown if an attempt is made to signal an event
when the reactor is not running.void signalFinalize(T data) throws RestrictedCapabilityException, ReactorNotRunningException
data
- This is the signal data parameter which will be passed to each
subscribed signalable object in turn. It is good practice to make
this parameter object immutable.RestrictedCapabilityException
- This exception is thrown if an attempt is made to call this
method on a signal event object reference with restricted
capability.ReactorNotRunningException
- This exception is thrown if an attempt is made to signal an event
when the reactor is not running.Signal<T> makeRestricted()
signal
and signalFinalize
methods are protected from unauthorised use.Signal
interface with
restricted capability.