If the Signal
passed to handle
has name "TERM"
then do something, otherwise, ignore it.
class MySignalHandler implements SignalHandler {
public void handle(Signal sig) {
if (!"TERM".equals(sig.getName())) {
SigHandler.SIG_DFL.handle(sig);
return;
}
// Handling code goes here.
}
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…