jvm - How to execute the specified command when java exits abnormally
PHPz
PHPz 2017-05-17 10:00:01
0
1
578

Just before the java process exits abnormally, how to execute the specified command to retain the state of the system at that time? I saw a blog on the Internet that said that commands can be executed, but there was no specific explanation. .

PHPz
PHPz

学习是最好的投资!

reply all(1)
大家讲道理

Is the abnormal exit you are talking about a jvm crash? Or just throw an Error like OOM?
If it is the former, then no measures can guarantee that you will record the status of the system. It is very likely that like TerminateProcess and kill -9, the process will disappear without leaving a trace. TerminateProcesskill -9一样,进程会不留痕迹地消失。
如果是后者的话,addShutdownHookIf it’s the latter, addShutdownHook should be able to do it.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!