since contrib/ntservice is unfinished (kills JVM before shutdown hooks have been run), we're using the Alexandria JavaService to run JBoss as a Windows 2000 service.
JavaService supports calling a static method to cleanly shut down an application before killing the JVM. However, it expects the shutdown process to have finished by the time the shutdown method returns. Since a call to org.jboss.Shutdown.main() returns before JBoss has cleanly shut down, even the Alexandria service would kill JBoss too early. However, a simple one line patch will fix this: add System.exit(0) to the end of org.jboss.Shutdown.main(). When called inside the JVM running JBoss, this will "never return", ie wait until all shutdown hooks have finished. When called from another Java process, it will work as before (since return from Shutdown.main() would exit anyway). This way, a clean shutdown is guaranteed even as a win32 service. Patch below. If this is deemed undesirable, could another static method which guarantees to not return until the shutdown hooks have finished be added? Thanks, //osma -- Q u a r t a l O y Osma Ahvenlampi, Technical Project Director ([EMAIL PROTECTED]) mobile +358 [0]424 258 239 fax +358 [0]424 258 360 http://www.quartal.com
--- jboss-3.0.0-src/system/src/main/org/jboss/Shutdown.java~ Mon May 20 03:33:22 2002 +++ jboss-3.0.0-src/system/src/main/org/jboss/Shutdown.java Wed Jun 12 16:38:57 +2002 @@ -55,6 +55,8 @@ } shutdown(host, port); + + System.exit(0); // waits for in-JVM shutdown hooks to finish } /**