Search code examples
javajakarta-eewildfly-8mbeans

JMXKernelMBean not available in wildfly 8 for shutting down server


My application running in JBoss 6 AS contains a below code snippet related to shutting down of JBoss server. Now, am migrating to Wildfly 8 AS and could not find a module or api within Wildfly AS to find the class JMXKernelMBean.

JMXKernelMBean<?,?> jmxKernelMBean = (JMXKernelMBean<?,?>) MBeanServerInvocationHandler.
            .newProxyInstance(
                    MBeanServerLocator.locateJBoss(),
                    new ObjectName("jboss.system:type=Server"),
                    JMXKernelMBean.class,
                    false);
jmxKernelMBean.shutDown();

Can anyone please help about the api or module used in Wildfly 8 for the same purpose of shutting down the server. Many thanks.


Solution

  • Calling System.exit() will calls the JVM's shutdown hooks, including the one Wildfly installs that triggers clean shutdown.