use of sun.misc.SignalHandler in project bazel by bazelbuild.
the class SignalHandlersTest method testHandlersCanBeChained.
@Test
public void testHandlersCanBeChained() {
SignalHandler handler1 = Mockito.mock(SignalHandler.class);
SignalHandler handler2 = Mockito.mock(SignalHandler.class);
signalHandlers.installHandler(TERM_SIGNAL, handler1);
signalHandlers.installHandler(TERM_SIGNAL, handler2);
fakeSignalInstaller.sendSignal();
Mockito.verify(handler1).handle(Mockito.eq(TERM_SIGNAL));
Mockito.verify(handler2).handle(Mockito.eq(TERM_SIGNAL));
}
use of sun.misc.SignalHandler 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.SignalHandler 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