use of sun.misc.Signal in project orientdb by orientechnologies.
the class OSignalHandler method listenTo.
public void listenTo(final String name, final SignalHandler iListener) {
Signal signal = new Signal(name);
SignalHandler redefinedHandler = Signal.handle(signal, iListener);
if (redefinedHandler != null) {
redefinedHandlers.put(signal, redefinedHandler);
}
}
use of sun.misc.Signal in project jdk8u_jdk by JetBrains.
the class Terminator method setup.
/* Invocations of setup and teardown are already synchronized
* on the shutdown lock, so no further synchronization is needed here
*/
static void setup() {
if (handler != null)
return;
SignalHandler sh = new SignalHandler() {
public void handle(Signal sig) {
Shutdown.exit(sig.getNumber() + 0200);
}
};
handler = sh;
// System.exit()
try {
Signal.handle(new Signal("INT"), sh);
} catch (IllegalArgumentException e) {
}
try {
Signal.handle(new Signal("TERM"), sh);
} catch (IllegalArgumentException e) {
}
}
Aggregations