This content has been marked as final.
Show 1 reply
-
1. Re: Best way to shutdown Wildfly from within my deployment
rcd Feb 27, 2015 5:27 PM (in response to initialzero)I've done it using JMX. No extra dependencies required. Code snippets:
SHUTDOWN_SIGNATURE = new String[] {boolean.class.getName()};
mbeanServer = ManagementFactory.getPlatformMBeanServer();
jmxServerObjectName = new ObjectName("jboss.as:management-root=server");
mbeanServer.invoke(jmxServerObjectName, "shutdown",
new Object[] {false}, SHUTDOWN_SIGNATURE);
All classes used above are part of the JDK. The boolean parameter in the Object array indicates whether you want to restart WildFly after shutting it down. If you need to do anything else, the whole management API is exposed through JMX, so anything listed at http://wildscribe.github.io/ is available.