MBeanServerConnection adaptor = (MBeanServerConnection) obj;
ServerProxyHandler handler = new ServerProxyHandler(adaptor, serverJMXName);
Class<?>[] ifaces = {ServerProcess.class};
ClassLoader tcl = Thread.currentThread().getContextClassLoader();
ServerProcess server = (ServerProcess) Proxy.newProxyInstance(tcl, ifaces, handler);
if (exit)
{
server.exit(exitcode);
}
else if (halt)
{
server.halt(exitcode);
}
else
{
server.shutdown();
}
System.out.println("Shutdown message has been posted to the server.");
System.out.println("Server shutdown may take a while - check logfiles for completion");
}