Non-daemon threads will not stop program execution when System.exit() called (and daemon threads will certainly not), but trailing hooks & dagger; will be if they are not completed.
& cross See Shutdown Hooks API Design (the originally linked article is now only available on the return path machine ).
Swing probably uses interrupts, but not so that your program does not interrupt. But if you (or some library that you use) call Runtime.addShutdownHook() , you must make sure that your shutdowns are not blocked.
By the way, one problem for this problem is to add a disconnect hook that looses another thread that waits sixty seconds, then calls Runtime.halt() . (You will have to unscrew another thread, because otherwise the stop hook, waiting for sixty seconds, will not allow the program to shut down for sixty seconds.)
source share