What's a good way of programmatically restarting JBoss? The reason for wanting to do this is that we're actually swapping out the database and replacing it with a new one, and want JBoss to reconnect its data source.
There doesn't appear to be a restart method on the server MBean.
I did try exiting JBoss with a special status code catching that in the startup script and restarting, but that didn't work. Regardless of the error code I exit with (either by calling the server MBean's exit method, or even calling System.exit directly), I'm getting status 0 back in the start script.
This is JBoss 3.0.6 on Windows 2k. Any suggestions would be appreciated.
For the record, I have the answer to part of my own question.
If you set the system property jboss.shutdown.forceHalt to false, then JBoss will exit with your specified exit code. Otherwise, one of its shutdown hooks calls Runtime.getRuntime().halt(0), shutting the VM down hard. I'm not sure why that's the default behavior, but there it is.