- All Implemented Interfaces:
public class LocalSignalReceiver extends AbstractSignalReceiver
A signal receiver implementation that can receive signals from the local virtual machine only. The corresponding transporter class is
- Last modified
- $Date: 2014-04-09 14:21:20 +0200 (on, 09 apr 2014) $
Constructors Constructor Description
()Create a new local signal receiver.
Modifier and Type Method Description
(int wait)Close this signal receiver.
String id)(Get a signal receiver with a given ID.
Class<? extends SignalTransporter>
()Get the signal transporter class that should be used to send signals to this receiver.
String params)(Initialise the signal receiver.
String handlerId, Signal signal)(Send the signal to a registered handler.
Methods inherited from class net.sf.basedb.core.signal.AbstractSignalReceiver
getGlobalSignalId, getLocalSignalHandlerId, getReceiverId, getSignalHandler, processSignalMessage, registerSignalHandler, sendToAll, unregisterSignalHandler
loggerprivate static final org.slf4j.Logger loggerLog signals processing.
receiversHolds all registered signal receivers.
receiverIdprivate String receiverId
LocalSignalReceiverpublic LocalSignalReceiver()Create a new local signal receiver. Before it can be used it must be initialised with
getSignalReceiverGet a signal receiver with a given ID.
id- The ID of the signal receiver
- A signal receiver, or null if no receiver with the given ID exists.
initpublic void init(String params)Initialise the signal receiver. The given parameter becomes the ID of the receiver. When this method return the signal receiver is ready to register signal handlers and receive signals.
closepublic void close(int wait)Description copied from class:
AbstractSignalReceiverClose this signal receiver. If a subclass overrides this method it should call
super.close()if it wants to use the default shutdown notification to signal handlers. This implementation will start a separate notification thread that first sends the
Signal.SHUTDOWNsignal to all registered handlers, and then
Signal.ABORTsignal to all that are still alive after the shutdown signal. The current thread will wait at most the given time. If the number of registered handlers goes down to 0 before the time has ended the current thread will be awakened so it can continue. Note that the notification thread will usually finish in a short time, but it may take longer for all worker thread of each job to react to the signal.
getSignalTransporterClassDescription copied from interface:
SignalReceiverGet the signal transporter class that should be used to send signals to this receiver.
sendSend the signal to a registered handler. If no handler with the given ID is found this method does nothing. The signal will be processed by the handler in the current thread.
handlerId- The ID of a registered handler
signal- The signal to send