How to shutdown java application correctly from C# one

后端 未结 1 1655
无人共我
无人共我 2021-01-16 07:17

I have java application which shutdowns correctly when i use CTRL-C, java application saves all data before shutdown. Now i trying to shutdown this java applica

相关标签:
1条回答
  • 2021-01-16 07:26

    A shutdown hook cannot be raised by another app.

    The shutdown hook runs when:

    • A program exists normally. For example, System.exit() is called, or the last non-daemon thread exits.
    • the Virtual Machine is terminated. e.g. CTRL-C. This corresponds to kill -SIGTERM pid or kill -15 pid on Unix systems.

    The shutdown hook will not run when:

    • the Virtual Machine aborts
    • A SIGKILL signal is sent to the Virtual Machine process on Unix systems. e.g. kill -SIGKILL pid or kill -9 pid
    • A TerminateProcess call is sent to the process on Windows systems.
    0 讨论(0)
提交回复
热议问题