When Shutdown Hooks Break Bad

前端 未结 5 580
暖寄归人
暖寄归人 2021-01-17 16:53

If I add a shutdown hook to my Java program\'s runtime like so:

public class MyShutdownHook implements Runnable
{
    @Override
    public void run(         


        
5条回答
  •  野的像风
    2021-01-17 17:30

    • If the process is killed, a shutdown hook will not be executed.

    • If the process crashes, a shutdown hook will not be executed.

    • If you have a Windows service and the shutdown hook takes to long to execute, it will be terminated.

提交回复
热议问题