How to detect program java force to close from Windows Task Manager?

元气小坏坏 提交于 2019-12-05 07:54:47
Sam

To catch regular terminate requests like SIGTERM or WM_CLOSE, as sent via the taskmanager's 'Applications' tab, a shutdown hook can be installed (I assume, you're using Windows, but that doesn't make much of a difference).

However, when killing from the 'processes' tab, or with taskkill /f ... on Windows or kill -9 ... on Linux or Unix, the process (VM) gets forcibly terminated, unable react. The same goes for kills done via 'application not responding' dialogs on Windows.

So you need to make sure, that you can handle files, which are corrupted/incomplete as a result of a forced kill (apart from power outages or hardware failures).

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!