|
2.17.2: 2011-06-17 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface SignalReceiver
A signal receiver is a class that knows how to receive a Signal
from a
SignalTransporter
and how to distribute this to a SignalHandler
.
Signal receivers are needed to decouple the actual signal handling from
the transportation of signals. A signal receiver implementation usually
comes in pair with a singal transporter implementation. See, for example,
the SocketSignalReceiver
and SocketSignalTransporter
implementations
which uses network sockets to transport signals.
Signal receivers must be thread safe since a single receiver may be used to handle signals for multiple jobs at the same time.
SignalTransporter
,
SignalHandler
Method Summary | |
---|---|
void |
close(int wait)
Close the receiver. |
Class<? extends SignalTransporter> |
getSignalTransporterClass()
Get the signal transporter class that should be used to send signals to this receiver. |
void |
init(String params)
Initialise the signal receiver. |
String |
registerSignalHandler(SignalHandler handler)
Register a signal handler with this receiver. |
void |
sendToAll(Signal signal)
Deprecated. In 2.16, use sendToAll(SignalSender) instead |
void |
sendToAll(SignalSender sender)
Let the signal sender send one or more signals to all registered signal handlers on this reciever. |
void |
unregisterSignalHandler(SignalHandler handler)
Unregister a signal handler from this receiever. |
Method Detail |
---|
void init(String params)
params
- Parameters needed to initialise the receivervoid close(int wait)
wait
- If the value is zero or positive, the Signal.ABORT
should be sent to all registered signal handlers. The signal receiver
should then wait at most the specified number of milliseconds for
all signal handlers to get unregistered. If the timeout expires before
all signal handlers has processed the signal, the signal receiver should
continue it's shutdown.Class<? extends SignalTransporter> getSignalTransporterClass()
SignalTransporter
String registerSignalHandler(SignalHandler handler)
SignalTransporter.init(String)
method lets the transporter know how to send a signal to the specific
handler. The SocketSignalReceiver
will for example, include the
IP number and port the transporter should connect to and a unique ID that
allows the receiver to locate the signal hander the signal is intended for.
The format of the ID is implementation specific and need only to be understandable
by the receiver and transporter implementations.
handler
- The signal handler that should receive signals through this
receiver
AbstractSignalReceiver
void unregisterSignalHandler(SignalHandler handler)
handler
- The handler to unregister@Deprecated void sendToAll(Signal signal)
sendToAll(SignalSender)
instead
Signal.ABORT
when the system is shutting down.
signal
- The signal to sendvoid sendToAll(SignalSender sender)
sender
- A signal sender implementation
|
2.17.2: 2011-06-17 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |