-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Features:
- support close function regularly for command prompt terminal, jframe, applet, jfx
- support close function kill, shutdown and prevent
- support stop os from closing if your app is shutting down like eclipse does
Windows handle CTRL+CLOSE & SIGTERM also SIGINT and SIGBREAK. the process should be the same for other os's due to JNI:
https://docs.microsoft.com/en-us/windows/console/ctrl-close-signal?redirectedfrom=MSDN
https://stackoverflow.com/a/9277766/8477015
https://stackoverflow.com/questions/2541597/how-to-gracefully-handle-the-sigkill-signal-in-java
https://docs.microsoft.com/en-us/windows/console/ctrl-c-and-ctrl-break-signals
https://stackoverflow.com/questions/9277630/windows-shutdown-hook-on-java-application-run-from-a-bat-script
POSIX:
register signal handles for all signals that should stop or terminate the program. based on the value determines the exit code. if it's a normal code from an x button it should exit on 0 and call shutdown instead of term. if it's not a normal code then exit -1 and call terminate method instead of shutdown. terminate may have a timeout of 2-5s or less depending upon the code. normal is like SIGINT and maybe others and abnormal is SIGTERM and non handleables is SIGKILL