|
2.17.2: 2011-06-17 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.basedb.core.signal.AbstractSignalReceiver net.sf.basedb.core.signal.LocalSignalReceiver
public class LocalSignalReceiver
A signal receiver implementation that can receive signals from the
local virtual machine only. The corresponding transporter class
is LocalSignalTransporter
.
Field Summary | |
---|---|
private static Logger |
logger
Log signals processing. |
private String |
receiverId
|
private static Map<String,LocalSignalReceiver> |
receivers
Holds all registered signal receivers. |
Constructor Summary | |
---|---|
LocalSignalReceiver()
Create a new local signal receiver. |
Method Summary | |
---|---|
void |
close(int wait)
Close this signal receiver. |
static LocalSignalReceiver |
getSignalReceiver(String id)
Get a signal receiver with a given ID. |
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. |
void |
send(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, sendToAll, unregisterSignalHandler |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final Logger logger
private static Map<String,LocalSignalReceiver> receivers
private String receiverId
Constructor Detail |
---|
public LocalSignalReceiver()
init(String)
.
Method Detail |
---|
public static LocalSignalReceiver getSignalReceiver(String id)
id
- The ID of the signal receiver
public void init(String params)
init
in interface SignalReceiver
init
in class AbstractSignalReceiver
params
- The ID of the signal receiver, needed if the default
ID generation should be usedpublic void close(int wait)
AbstractSignalReceiver
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.SHUTDOWN
signal to all registered handlers, and then
Signal.ABORT
signal 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.
close
in interface SignalReceiver
close
in class AbstractSignalReceiver
wait
- Number of milliseconds to wait for registered jobs to abort,
use a negative value to disable notification, and 0 to disable waitingpublic Class<? extends SignalTransporter> getSignalTransporterClass()
SignalReceiver
LocalSignalTransporter
public void send(String handlerId, Signal signal)
handlerId
- The ID of a registered handlersignal
- The signal to send
|
2.17.2: 2011-06-17 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |