[jboss-cvs] JBossAS SVN: r88845 - in branches/Branch_5_x_BootstrapLegacyRemoval: server and 2 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed May 13 19:24:07 EDT 2009
Author: ALRubinger
Date: 2009-05-13 19:24:06 -0400 (Wed, 13 May 2009)
New Revision: 88845
Added:
branches/Branch_5_x_BootstrapLegacyRemoval/system-jmx/src/main/org/jboss/system/server/ServerConstants.java
Modified:
branches/Branch_5_x_BootstrapLegacyRemoval/main/src/main/org/jboss/Main.java
branches/Branch_5_x_BootstrapLegacyRemoval/server/build.xml
branches/Branch_5_x_BootstrapLegacyRemoval/server/src/main/org/jboss/Shutdown.java
branches/Branch_5_x_BootstrapLegacyRemoval/system-jmx/src/main/org/jboss/system/server/ServerImplMBean.java
Log:
[JBAS-6856] AS smoke-tests passing locally on new bootstrap
Modified: branches/Branch_5_x_BootstrapLegacyRemoval/main/src/main/org/jboss/Main.java
===================================================================
--- branches/Branch_5_x_BootstrapLegacyRemoval/main/src/main/org/jboss/Main.java 2009-05-13 23:23:15 UTC (rev 88844)
+++ branches/Branch_5_x_BootstrapLegacyRemoval/main/src/main/org/jboss/Main.java 2009-05-13 23:24:06 UTC (rev 88845)
@@ -858,16 +858,19 @@
*/
private static class ShutdownHook extends Thread
{
-
- // Underlying server instance
+
+ /**
+ * Underlying server instance
+ */
private Server<?, ?> server;
/**
* Constructor
*
* @param server
+ * @param exitCode
*/
- public ShutdownHook(final Server<?, ?> server)
+ ShutdownHook(final Server<?, ?> server)
{
this.server = server;
}
@@ -883,23 +886,33 @@
{
// Log out
System.out.println("Posting Shutdown Request to the server...");
-
+
// If we're started or starting
final LifecycleState currentState = server.getState();
if (currentState.equals(LifecycleState.STARTED) || currentState.equals(LifecycleState.STARTING))
{
- try
+ // start in new thread to give positive
+ // feedback to requesting client of success.
+ new Thread()
{
- // Shutdown
- server.shutdown();
- }
- // In case of any Exception thrown up the chain, let us know
- catch (final Exception e)
- {
- throw new RuntimeException("Exception encountered in shutting down the server", e);
- }
+ public void run()
+ {
+ try
+ {
+ // just run the hook, don't call System.exit, as we may
+ // be embeded in a vm that would not like that very much
+ server.shutdown();
+ }
+ // In case of any Exception thrown up the chain, let us know
+ catch (final Exception e)
+ {
+ throw new RuntimeException("Exception encountered in shutting down the server", e);
+ }
+ }
+ }.start();
}
- }
+
+ }
}
}
Modified: branches/Branch_5_x_BootstrapLegacyRemoval/server/build.xml
===================================================================
--- branches/Branch_5_x_BootstrapLegacyRemoval/server/build.xml 2009-05-13 23:23:15 UTC (rev 88844)
+++ branches/Branch_5_x_BootstrapLegacyRemoval/server/build.xml 2009-05-13 23:24:06 UTC (rev 88845)
@@ -506,19 +506,13 @@
</fileset>
</jar>
- <!-- Inflate out contents of the Bootstrap JAR into a Temp Directory -->
+ <!-- Inflate out contents of the Bootstrap SPIs into a Temp Directory -->
<property name="inflated.dir" value="tmp-bootstrap" />
<mkdir dir="${inflated.dir}"/>
<unjar dest="${inflated.dir}">
<fileset dir="${jboss.jboss.bootstrap.spi.lib}">
<include name="jboss-bootstrap-spi.jar"/>
</fileset>
- <fileset dir="${jboss.jboss.bootstrap.spi.mc.lib}">
- <include name="jboss-bootstrap-spi-mc.jar"/>
- </fileset>
- <fileset dir="${jboss.jboss.bootstrap.spi.as.lib}">
- <include name="jboss-bootstrap-spi-as.jar"/>
- </fileset>
</unjar>
<!-- Build shutdown.jar -->
@@ -532,10 +526,7 @@
</fileset>
<!-- Add some classes from Bootstrap -->
<fileset dir="${inflated.dir}">
- <include name="org/jboss/bootstrap/spi/Server.class"/>
- <include name="org/jboss/bootstrap/spi/ServerConfig.class"/>
- <include name="org/jboss/bootstrap/spi/ServerProcess.class"/>
- <include name="org/jboss/bootstrap/spi/util/ServerConfigUtil.class"/>
+ <include name="org/jboss/bootstrap/spi/**/*.class"/>
</fileset>
<!-- Include getopt -->
Modified: branches/Branch_5_x_BootstrapLegacyRemoval/server/src/main/org/jboss/Shutdown.java
===================================================================
--- branches/Branch_5_x_BootstrapLegacyRemoval/server/src/main/org/jboss/Shutdown.java 2009-05-13 23:23:15 UTC (rev 88844)
+++ branches/Branch_5_x_BootstrapLegacyRemoval/server/src/main/org/jboss/Shutdown.java 2009-05-13 23:24:06 UTC (rev 88845)
@@ -38,11 +38,10 @@
import javax.naming.Context;
import javax.naming.InitialContext;
-import org.jboss.bootstrap.spi.as.server.JBossASServer;
+import org.jboss.bootstrap.spi.server.Server;
import org.jboss.naming.HttpNamingContextFactory;
import org.jboss.security.SecurityAssociation;
import org.jboss.security.SimplePrincipal;
-import org.jboss.system.server.ServerImplMBean;
import org.jnp.interfaces.NamingContext;
/**
@@ -79,8 +78,6 @@
System.out.println();
System.out.println("operations:");
System.out.println(" -S, --shutdown Shutdown the server");
- System.out.println(" -e, --exit=<code> Force the VM to exit with a status code");
- System.out.println(" -H, --halt=<code> Force the VM to halt with a status code");
System.out.println();
}
@@ -92,7 +89,7 @@
System.exit(0);
}
- String sopts = "-:hD:s:n:a:u:p:Se:H:";
+ String sopts = "-:hD:s:n:a:u:p:S";
LongOpt[] lopts =
{
new LongOpt("help", LongOpt.NO_ARGUMENT, null, 'h'),
@@ -100,8 +97,6 @@
new LongOpt("adapter", LongOpt.REQUIRED_ARGUMENT, null, 'a'),
new LongOpt("serverName", LongOpt.REQUIRED_ARGUMENT, null, 'n'),
new LongOpt("shutdown", LongOpt.NO_ARGUMENT, null, 'S'),
- new LongOpt("exit", LongOpt.REQUIRED_ARGUMENT, null, 'e'),
- new LongOpt("halt", LongOpt.REQUIRED_ARGUMENT, null, 'H'),
new LongOpt("user", LongOpt.REQUIRED_ARGUMENT, null, 'u'),
new LongOpt("password", LongOpt.REQUIRED_ARGUMENT, null, 'p'),
};
@@ -114,10 +109,7 @@
String adapterName = "jmx/rmi/RMIAdaptor";
String username = null;
String password = null;
- ObjectName serverJMXName = ServerImplMBean.OBJECT_NAME;
- boolean exit = false;
- boolean halt = false;
- int exitcode = -1;
+ ObjectName serverJMXName = new ObjectName("jboss.system:type=Server");
while ((code = getopt.getopt()) != -1)
{
@@ -178,14 +170,6 @@
password = getopt.getOptarg();
SecurityAssociation.setCredential(password);
break;
- case 'e':
- exitcode = Integer.parseInt(getopt.getOptarg());
- exit = true;
- break;
- case 'H':
- exitcode = Integer.parseInt(getopt.getOptarg());
- halt = true;
- break;
}
}
@@ -224,9 +208,9 @@
MBeanServerConnection adaptor = (MBeanServerConnection) obj;
ServerProxyHandler handler = new ServerProxyHandler(adaptor, serverJMXName);
- Class<?>[] ifaces = {JBossASServer.class};
+ Class<?>[] ifaces = {Server.class};
ClassLoader tcl = Thread.currentThread().getContextClassLoader();
- JBossASServer server = (JBossASServer) Proxy.newProxyInstance(tcl, ifaces, handler);
+ Server<?,?> server = (Server<?,?>) Proxy.newProxyInstance(tcl, ifaces, handler);
server.shutdown();
System.out.println("Shutdown message has been posted to the server.");
Added: branches/Branch_5_x_BootstrapLegacyRemoval/system-jmx/src/main/org/jboss/system/server/ServerConstants.java
===================================================================
--- branches/Branch_5_x_BootstrapLegacyRemoval/system-jmx/src/main/org/jboss/system/server/ServerConstants.java (rev 0)
+++ branches/Branch_5_x_BootstrapLegacyRemoval/system-jmx/src/main/org/jboss/system/server/ServerConstants.java 2009-05-13 23:24:06 UTC (rev 88845)
@@ -0,0 +1,43 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, 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;
+
+import javax.management.ObjectName;
+
+import org.jboss.mx.util.ObjectNameFactory;
+
+/**
+ * ServerConstants
+ *
+ * Holds constants used for the Server MBean. This
+ * class is primarily in place such that we may access
+ * properties without leaking JBossASServer and MC Kernel
+ * references like {@link ServerImplMBean} does.
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+public interface ServerConstants
+{
+ /** The default object name */
+ ObjectName OBJECT_NAME = ObjectNameFactory.create("jboss.system:type=Server");
+}
Modified: branches/Branch_5_x_BootstrapLegacyRemoval/system-jmx/src/main/org/jboss/system/server/ServerImplMBean.java
===================================================================
--- branches/Branch_5_x_BootstrapLegacyRemoval/system-jmx/src/main/org/jboss/system/server/ServerImplMBean.java 2009-05-13 23:23:15 UTC (rev 88844)
+++ branches/Branch_5_x_BootstrapLegacyRemoval/system-jmx/src/main/org/jboss/system/server/ServerImplMBean.java 2009-05-13 23:24:06 UTC (rev 88845)
@@ -21,19 +21,13 @@
*/
package org.jboss.system.server;
-import javax.management.ObjectName;
-
import org.jboss.bootstrap.spi.as.server.JBossASServer;
-import org.jboss.mx.util.ObjectNameFactory;
/**
* MBean interface.
*/
-public interface ServerImplMBean extends JBossASServer
+public interface ServerImplMBean extends JBossASServer, ServerConstants
{
- /** The default object name */
- ObjectName OBJECT_NAME = ObjectNameFactory.create("jboss.system:type=Server");
-
// Attributes ----------------------------------------------------
/**
More information about the jboss-cvs-commits
mailing list