Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.


#239 clean jboss 3.0 shutdown as a win32 serv

v3.0 Rabbit Hole
Osma Ahvenlampi

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

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?


  • add System.exit(0) to Shutdown.main()