![]() |
Sponsored Link •
|
Advertisement
|
Advertisement
|
This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.
Message:
If you have used Windows, you've probably (too often) seen this scenario: you have some program freezing up the system and decide to shutdown via task manager after Ctl-alt-del. After about 20 seconds a dialog pops up saying a program is not responding and you have the choice to kill it or wait. What happened was Windows broadcast the shutdown request message (WM_ENDSESSION) to all processes, but one (or more) did not shutdown as requested and Windows is weary of waiting. Now if you choose to end it, the process will simply be terminated. If that process was a JVM, then when it first got the shutdown request from Windows, it would have started shutting down and started all the registered shutdown hook threads. If any of the hooks had taken to long and were still grinding away, they would then be in the dangerous position of potentially being croaked mid-task. Now, you could do a Runtime.exec() to start some process in your shutdown hook, but this may be a risky thing to do, because you don't know if only the JVM is shutting down, or if the whole OS is. As is often the case in nature, ontology recapitulates phylogeny: what happens inside the JVM is much like what happens in the OS outside of it (and you sure can't run any processes on the OS after you've really lost your patience and plulled the plug out of the wall). - mfg
Replies: |
Sponsored Links
|