-
1. Re: How to shutdown Wildfly 8.2.0 AS programatically
jewellgm Jul 13, 2015 9:15 AM (in response to sridharthiyagarajan)1 of 1 people found this helpfulThe shutdown command in WildFly was changed to take an additional "timeout" parameter. This allows for a graceful shutdown. Try this:
mbeanServer.invoke(objectName, new Object[] {false, 0}, new String[] {boolean.class.getName(), int.class.getName()});
EDIT: The graceful shutdown was added to WildFly 9. Unfortunately, my suggestion won't make a difference in WF 8.
-
2. Re: How to shutdown Wildfly 8.2.0 AS programatically
jameslivingston Jul 13, 2015 7:53 PM (in response to sridharthiyagarajan)1 of 1 people found this helpfulI expect the problem will be that the JMX method invocation is synchronous, and waits for it to "complete", but JBoss will be waiting for you initialization method to finish before it shuts down. You probably need to run that in another thread and have the initialization method throw an exception too.
An application trying to make the server shut down during initialization is a bit weird, and there may be more issues you run into.
-
3. Re: How to shutdown Wildfly 8.2.0 AS programatically
sridharthiyagarajan Jul 14, 2015 10:14 AM (in response to jameslivingston)Many thanks for the response.. James. I will try shutting down the server in a separate thread.
-
4. Re: How to shutdown Wildfly 8.2.0 AS programatically
sridharthiyagarajan Jul 20, 2015 6:50 AM (in response to sridharthiyagarajan)Many thanks .. James. Shutting down the server in a separate thread worked fine. Many thanks for Greg for adding valuable inputs on shutting down server.