1

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.

TT.
  • 15,774
  • 6
  • 47
  • 88
Ankit Rustagi
  • 5,539
  • 12
  • 39
  • 70

2 Answers2

0

JBoss EAP 6/7 and above allows graceful shutdown via CLI and even:

The signals SIGHUP, SIGINT and SIGTERM all trigger a graceful shutdown of the JBoss 7/6 application server. Those are signals are respectively the commands kill -1 $PID, kill -2 $PID(or control+c), and kill $PID.

https://access.redhat.com/solutions/18601

gavenkoa
  • 45,285
  • 19
  • 251
  • 303
-1

You can use the Jboss cli remotely as the URL you pass in the controller param shows. You could even use the "REST" API to execute it. The shutdown should be available from JMX.

ehsavoie
  • 3,126
  • 1
  • 16
  • 14