Package net.sf.basedb.core.signal
Interface SignalHandler
- All Superinterfaces:
Action
- All Known Implementing Classes:
AbstractSignalHandler
,DelegatingSignalHandler
,EnhancedThreadSignalHandler
,ForwardingSignalHandler
,ProgressReporterSignalHandler
,ThreadSignalHandler
A signal handler is an object that is able to receive and act on signals.
A specific signal handler instance may only support a subset of all
registered signals (see
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.
- Version:
- 2.6
- Author:
- nicklas
- Last modified
- $Date: 2014-03-14 08:23:38 +0100 (fr, 14 mar 2014) $
-
Method Summary
Modifier and TypeMethodDescriptionGet all signals that are supported by this handler.void
handleSignal
(Signal signal) Handle the given signal.boolean
Check if a given signal is supported.
-
Method Details
-
handleSignal
Handle the given signal. It is recommended that signals are handled as quickly as possible. If there is a risk that it may take a long time it is recommended to spawn a new thread and handle the signal asynchronously.- Parameters:
signal
- The signal to handle- Throws:
UnsupportedSignalException
- If the signal is not supported
-
getSupportedSignals
Collection<Signal> getSupportedSignals()Get all signals that are supported by this handler.- Returns:
- A collection of signals
-
supports
Check if a given signal is supported.- Parameters:
signal
- The signal to check- Returns:
- TRUE if the signal is supported, FALSE otherwise
-