Monday, July 15, 2002 12:51 PM
I think you need to use a shutdown hook in the vm to tell your running threads to stop. A shutdown hook is just a means to enable graceful exit.
You add the shutdown hook thus:
is a thread.
The VM only exits when all the shutdown hooks have been run. But, depending on how the VM was terminated, the shutdown hooks may not have a chance to run at all. I think using something like 'kill -9 pid' will kill a VM without hooks running, but CTRL-c for example will allow the hooks to run.