本文介绍了确定应用程序是否正常关闭的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法确定jvm是否正常关闭? Shutdown hook只能生成一个线程,有没有办法确定JVM当时是正常存在还是异常存在?

is there a way to determing if a jvm is shutting down normally? Shutdown hook can only spawn a thread, is there a way to determine if the JVM is existing normally or abnormally at that time?

推荐答案

我记得很久以前被问过的。一种可能的做法是使用。

I remembered a similar question being asked time ago. One possible course of action is the use of SignalHandler.

您可以阅读。它似乎与IBM JVM有关,但我认为它对Java Hotspot同样有效。

You can read the full article here. It appears to be related to IBM JVM but I think it is equally valid for Java Hotspot.

这篇关于确定应用程序是否正常关闭的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-18 10:01
查看更多