public interface SignalHandler extends Action
Signal.getSignals()
). A signal handler is usually
created by a SignalTarget
. When the handler receives a signal, it should
in most cases notify the target about it. How this is done is up to each
implementation.
Signal handler implementations need to be implemented in a thread safe. Once
they have been registered with a SignalReceiver
they may receive
multiple signals in different threads at the same time.
Modifier and Type | Method and Description |
---|---|
Collection<Signal> |
getSupportedSignals()
Get all signals that are supported by this handler.
|
void |
handleSignal(Signal signal)
Handle the given signal.
|
boolean |
supports(Signal signal)
Check if a given signal is supported.
|
void handleSignal(Signal signal)
signal
- The signal to handleUnsupportedSignalException
- If the signal is not supportedCollection<Signal> getSupportedSignals()
boolean supports(Signal signal)
signal
- The signal to check