Package net.sf.basedb.core.signal
Interface SignalTransporter
-
- All Known Implementing Classes:
AbstractSignalTransporter
,ExtensionSignalTransporter
,Job.JobSignalTransporter
,LocalSignalTransporter
,SocketSignalTransporter
public interface SignalTransporter
A signal transporter is a class that knows how to send a signal to a specificSignalReceiver
implementation. Implementing classes must have a public no-argument constructor. Before signals can be sent with the transporter theinit(String)
method is called with the same string as returned by theSignalReceiver.registerSignalHandler(SignalHandler)
method. This string should contain enough information to let the transporter send the signal to the correct signal handler on the correct signal receiver. The format of this string is implementation-specific and needs only to be known by the coupled transporter and receiver classes. As an example, theSocketSignalReceiver
andSocketSignalTransporter
uses aURI
that contains the IP number and port of the receiver and an ID for identifying the signal handler.Signal transporters need not be thread safe since a new instance is created for each signal that is going to be sent.
- Version:
- 2.6
- Author:
- nicklas
- Last modified
- $Date: 2008-09-11 22:09:17 +0200 (to, 11 sep 2008) $
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Collection<Signal>
getSupportedSignals()
Get a collection containing the signals supported, by the signal handler.void
init(String params)
Initialise the signal transporter.void
send(Signal signal)
Send a signal.
-
-
-
Method Detail
-
init
void init(String params)
Initialise the signal transporter. The parameter is the same as returned bySignalReceiver.registerSignalHandler(SignalHandler)
and should contain information that the transporter can parse and use for contacting the correct signal receiver and to send signals to the registered signal handler.- Parameters:
params
- The initialisation string
-
getSupportedSignals
Collection<Signal> getSupportedSignals()
Get a collection containing the signals supported, by the signal handler. A null return value means that the transporter just doesn't know about which signals are supported and which are not.- Returns:
- A collections with the signals, or null
-
send
void send(Signal signal)
Send a signal.- Parameters:
signal
- The signal to send, must not be null
-
-