B4J Question Detect OS Shutdown

OliverA

Expert
Licensed User
Longtime User
Is there a way to detect this?
From my "quick" testing, no. @Deastrum's linked solution works under Windows when using CTRL-C to interrupt the program in a DOS command line session. I've not been able to use the solution to detect shutdowns via Task Manager, user logout, or system shutdowns. It does seem to work fairly well under Linux using the standard kill command, stopping it under systemd and shutting down/restarting Linux (tested on Ubuntu Server 18.04LTS). Note: The kill command can be used with various options that can be used to stop the .jar file without evoking the shutdown hook (and may be configured in such a way on other distributions).
 
Upvote 0

Blueforcer

Well-Known Member
Licensed User
Longtime User
while my testing , out of 5 stop calls it has called shutdown hook only once on windows shutdown
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…