本文整理汇总了Java中sun.misc.SignalHandler.handle方法的典型用法代码示例。如果您正苦于以下问题:Java SignalHandler.handle方法的具体用法?Java SignalHandler.handle怎么用?Java SignalHandler.handle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sun.misc.SignalHandler
的用法示例。
在下文中一共展示了SignalHandler.handle方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handle
import sun.misc.SignalHandler; //导入方法依赖的package包/类
/**
* Handle the caught signal dumping all locks and threads.
*/
public void handle(sun.misc.Signal sig) {
try {
final GemFireStore memStore = GemFireStore.getBootingInstance();
final Signal signal = Signal.valueOfName(sig.getName());
if (Signal.SIGURG.equals(signal)) {
final String header = "SIGURG received, full state dump";
GemFireXDUtils.dumpStacks(memStore, header);
}
else {
// just log any other unexpected signals
SanityManager.DEBUG_PRINT("warning:SignalHandler",
"received explicit OS signal SIG" + sig.getName(), new Throwable());
}
// Chain back to previous handler, if one exists
SignalHandler oldHandler = this.oldHandlers.get(signal);
if (oldHandler != null && oldHandler != SIG_DFL
&& oldHandler != SIG_IGN) {
oldHandler.handle(sig);
}
} catch (Throwable t) {
System.err.println("SigThreadDumpHandler failed to dump to log for SIG"
+ sig.getName() + ": " + SanityManager.getStackTrace(t));
}
}
示例2: handleDefault
import sun.misc.SignalHandler; //导入方法依赖的package包/类
protected void handleDefault(final sun.misc.Signal sig) {
final Signal signal = Signal.valueOfName(sig.getName());
switch (signal) {
case SIGINT:
break; // ignore the interrupt signal
default:
final SignalHandler handler = getOriginalSignalHandler(signal);
if (handler != null) {
handler.handle(sig);
}
}
}