I am looking for an approach to gracefully handle shutdown of JBoss (Wildfly AS 8.2). This would mean that all current requests are served and the webapp stops receiving further requests. I found that this is possible via command line in version 9
of the application server -
./jboss-cli.sh --controller=remoting://<host>:<port>
--connect --command=:shutdown(timeout=t)
Using this JBoss gracefully handles all requests for t
seconds and gracefully shuts down (this would require an upgrade from version 8 to 9).
One possible approach would be to handle this in the Java
application by maintaining a count of active requests and waiting for this number to go to 0
till a timeout and then exitting, basically replicating the above mentioned functionality.
I need to shutdown the webapp/JBoss remotely, so we are looking for a JMX
(Java Management Extension) based solution. Does JBoss
expose any such operation to gracefully shut down possibly via JMX
or any other technology?
PS- Ctrl-C
or kill
commands donot shutdown JBoss
gracefully.