I understand that stopping a service calls stop() in our main class. As part of our normal (Unix) shutdown we shutdown a few critical threads and close resources, then System.exit(0) if everything went OK (System.exit(-1) if something went wrong). But this procedure seems to cause Windows to complain that the application closed unexpectedly when an admin tries to stop our Java service application. I'm assuming that this is because there were still some threads running, meaning that the JVM didn't shutdown by itself.
If that's true, then I think this a bug, or at least a feature request... It seems to me that any exit code of '0' should be considered graceful/OK. Otherwise our very threaded service is going to require a lot of new code to track all our threads and gracefully stop them... overkill I think, given the nature of most of our threads. Or maybe setting all of those to "daemon" status would work with less trouble?
Any thoughts?
Thanks,
Chris
FOLLOW US
Get the latest news in Application Packaging