[jboss-cvs] JBossAS SVN: r111870 - in branches/JBPAPP_5_1_1_GA_JBPAPP-6913: server/src/main/org/jboss and 1 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Jul 28 11:11:16 EDT 2011


Author: csams
Date: 2011-07-28 11:11:16 -0400 (Thu, 28 Jul 2011)
New Revision: 111870

Added:
   branches/JBPAPP_5_1_1_GA_JBPAPP-6913/server/src/etc/deploy/jvm-shutdown-jboss-beans.xml
   branches/JBPAPP_5_1_1_GA_JBPAPP-6913/system-jmx/src/main/org/jboss/system/server/jmx/JVMShutdown.java
   branches/JBPAPP_5_1_1_GA_JBPAPP-6913/system-jmx/src/main/org/jboss/system/server/jmx/JVMShutdownMBean.java
Modified:
   branches/JBPAPP_5_1_1_GA_JBPAPP-6913/server/src/main/org/jboss/Shutdown.java
Log:
JBPAPP-6913 JVMShutdown bean and Shutdown modifications to use JVMShutdown for halt, exit, and shutdown

Added: branches/JBPAPP_5_1_1_GA_JBPAPP-6913/server/src/etc/deploy/jvm-shutdown-jboss-beans.xml
===================================================================
--- branches/JBPAPP_5_1_1_GA_JBPAPP-6913/server/src/etc/deploy/jvm-shutdown-jboss-beans.xml	                        (rev 0)
+++ branches/JBPAPP_5_1_1_GA_JBPAPP-6913/server/src/etc/deploy/jvm-shutdown-jboss-beans.xml	2011-07-28 15:11:16 UTC (rev 111870)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+	<bean name="jvmControl" class="org.jboss.system.server.jmx.JVMShutdown">
+			<property name="JMXKernel"><inject bean="JMXKernel" /></property>
+	</bean>
+</deployment>

Modified: branches/JBPAPP_5_1_1_GA_JBPAPP-6913/server/src/main/org/jboss/Shutdown.java
===================================================================
--- branches/JBPAPP_5_1_1_GA_JBPAPP-6913/server/src/main/org/jboss/Shutdown.java	2011-07-28 14:20:03 UTC (rev 111869)
+++ branches/JBPAPP_5_1_1_GA_JBPAPP-6913/server/src/main/org/jboss/Shutdown.java	2011-07-28 15:11:16 UTC (rev 111870)
@@ -38,13 +38,12 @@
 import gnu.getopt.Getopt;
 import gnu.getopt.LongOpt;
 
-import org.jboss.bootstrap.spi.Server;
-import org.jboss.bootstrap.spi.ServerProcess;
+import org.jboss.system.server.jmx.JVMShutdownMBean;
 import org.jboss.naming.HttpNamingContextFactory;
-import org.jboss.system.server.ServerImplMBean;
 import org.jboss.security.SecurityAssociation;
 import org.jboss.security.SimplePrincipal;
 import org.jnp.interfaces.NamingContext;
+import org.jboss.mx.util.ObjectNameFactory;
 
 /**
  * A JMX client that uses an MBeanServerConnection to shutdown a remote JBoss
@@ -115,7 +114,7 @@
       String adapterName = "jmx/rmi/RMIAdaptor";
       String username = null;
       String password = null;
-      ObjectName serverJMXName = ServerImplMBean.OBJECT_NAME;
+      ObjectName serverJMXName = ObjectNameFactory.create("jboss.system:type=JVMShutdown");
       boolean exit = false;
       boolean halt = false;
       int exitcode = -1;
@@ -225,9 +224,9 @@
 
       MBeanServerConnection adaptor = (MBeanServerConnection) obj;
       ServerProxyHandler handler = new ServerProxyHandler(adaptor, serverJMXName);
-      Class<?>[] ifaces = {ServerProcess.class};
+      Class<?>[] ifaces = {JVMShutdownMBean.class};
       ClassLoader tcl = Thread.currentThread().getContextClassLoader();
-      ServerProcess server = (ServerProcess) Proxy.newProxyInstance(tcl, ifaces, handler);
+      JVMShutdownMBean server = (JVMShutdownMBean) Proxy.newProxyInstance(tcl, ifaces, handler);
 
       if (exit)
       {

Added: branches/JBPAPP_5_1_1_GA_JBPAPP-6913/system-jmx/src/main/org/jboss/system/server/jmx/JVMShutdown.java
===================================================================
--- branches/JBPAPP_5_1_1_GA_JBPAPP-6913/system-jmx/src/main/org/jboss/system/server/jmx/JVMShutdown.java	                        (rev 0)
+++ branches/JBPAPP_5_1_1_GA_JBPAPP-6913/system-jmx/src/main/org/jboss/system/server/jmx/JVMShutdown.java	2011-07-28 15:11:16 UTC (rev 111870)
@@ -0,0 +1,68 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.system.server.jmx;
+
+import org.jboss.aop.microcontainer.aspects.jmx.JMX;
+import org.jboss.system.server.jmx.JMXKernel;
+
+/**
+ * An MBean that exposes through JMX the ability to shutdown the server with a particular
+ * exit code.
+ *
+ * @author <a href="mailto:csams at redhat.com">Chris Sams</a>
+ */
+ at JMX(name="jboss.system:type=JVMShutdown", exposedInterface=JVMShutdownMBean.class)
+public class JVMShutdown implements JVMShutdownMBean {
+	
+	private JMXKernel server;
+
+	public void exit(final int exitStatus)
+	{
+		server.exit(exitStatus);
+	}
+
+	public void exit()
+	{
+		server.exit();
+	}
+
+	public void halt(final int exitStatus)
+	{
+		server.halt(exitStatus);
+	}
+
+	public void halt()
+	{
+		server.halt();
+	}
+
+	public void shutdown()
+	{
+		server.shutdown();
+	}
+	
+	public void setJMXKernel(final JMXKernel server)
+	{
+		this.server = server;
+	}
+
+}

Added: branches/JBPAPP_5_1_1_GA_JBPAPP-6913/system-jmx/src/main/org/jboss/system/server/jmx/JVMShutdownMBean.java
===================================================================
--- branches/JBPAPP_5_1_1_GA_JBPAPP-6913/system-jmx/src/main/org/jboss/system/server/jmx/JVMShutdownMBean.java	                        (rev 0)
+++ branches/JBPAPP_5_1_1_GA_JBPAPP-6913/system-jmx/src/main/org/jboss/system/server/jmx/JVMShutdownMBean.java	2011-07-28 15:11:16 UTC (rev 111870)
@@ -0,0 +1,41 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.system.server.jmx;
+
+/**
+ * Interface for an MBean that exposes through JMX the ability to shutdown the server with a particular
+ * exit code.
+ *
+ * @author <a href="mailto:csams at redhat.com">Chris Sams</a>
+ */
+public interface JVMShutdownMBean {
+	
+	public void exit(final int exitStatus);
+	public void exit();
+
+	public void halt(final int exitStatus);
+	public void halt();
+
+	public void shutdown();
+
+}



More information about the jboss-cvs-commits mailing list