[Jboss-cvs] JBossAS SVN: r55433 - in branches/MC_VDF_WORK: server/src/etc/conf/default system/src/main/org/jboss/system/server system/src/main/org/jboss/system/server/profileservice

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Aug 9 08:02:02 EDT 2006


Author: scott.stark at jboss.org
Date: 2006-08-09 08:01:57 -0400 (Wed, 09 Aug 2006)
New Revision: 55433

Modified:
   branches/MC_VDF_WORK/server/src/etc/conf/default/deployer-beans.xml
   branches/MC_VDF_WORK/system/src/main/org/jboss/system/server/Server.java
   branches/MC_VDF_WORK/system/src/main/org/jboss/system/server/profileservice/ProfileServiceBootstrap.java
   branches/MC_VDF_WORK/system/src/main/org/jboss/system/server/profileservice/ServerImpl.java
Log:
Move all of the jmx initialization to the JMXKernel and have the SADeployer depend on the JMXKernel for the MBeanServer and ServiceController

Modified: branches/MC_VDF_WORK/server/src/etc/conf/default/deployer-beans.xml
===================================================================
--- branches/MC_VDF_WORK/server/src/etc/conf/default/deployer-beans.xml	2006-08-09 05:11:54 UTC (rev 55432)
+++ branches/MC_VDF_WORK/server/src/etc/conf/default/deployer-beans.xml	2006-08-09 12:01:57 UTC (rev 55433)
@@ -53,14 +53,15 @@
    <bean name="SARDeployer" class="org.jboss.deployment.SARDeployer">
       <classloader><inject bean="JMXClassLoader"/></classloader>
       <property name="useNamespaceAwareParser">true</property>
+      <property name="server"><inject bean="JMXKernel" property="mbeanServer" /></property>
+      <property name="serviceController"><inject bean="JMXKernel" property="serviceController" /></property>
    </bean>
 	<!-- A bean that setups a jboss-4.0.x type of jmx kernel to support the
 		the legacy mbean deployments handled by the SARDeployer
 	-->
    <bean name="JMXKernel" class="org.jboss.system.server.jmx.JMXKernel">
       <classloader><inject bean="JMXClassLoader"/></classloader>
-      <property name="serverImpl"><inject bean="ProfileService"/></property>
-      <property name="serviceController"><inject bean="SARDeployer" property="serviceController" /></property>
+      <property name="serverImpl"><inject bean="org.jboss.system.server.Server"/></property>
    </bean>
 
    <!-- Hot deployment service that directly uses the MainDeployer -->
@@ -70,7 +71,7 @@
       <property name="URIList">
          <list elementClass="java.net.URI"><value>${jboss.server.home.url}/deploy/</value></list>
       </property>
-      <property name="scanPeriod"><value>5000</value></property>
+      <property name="scanPeriod"><value>500000</value></property>
    </bean>
 	
 </deployment>

Modified: branches/MC_VDF_WORK/system/src/main/org/jboss/system/server/Server.java
===================================================================
--- branches/MC_VDF_WORK/system/src/main/org/jboss/system/server/Server.java	2006-08-09 05:11:54 UTC (rev 55432)
+++ branches/MC_VDF_WORK/system/src/main/org/jboss/system/server/Server.java	2006-08-09 12:01:57 UTC (rev 55433)
@@ -21,13 +21,16 @@
 */
 package org.jboss.system.server;
 
+import java.util.Date;
 import java.util.Properties;
 
 /**
- * The interface of the basic JBoss server component.
+ * The interface of the server loaded by the ServerLoader
+ * @see ServerLoader
  *
- * @version <tt>$Revision$</tt>
- * @author  <a href="mailto:jason at planet57.com">Jason Dillon</a>
+ * @author Jason Dillon
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
  */
 public interface Server
 {
@@ -36,6 +39,36 @@
    /** The JMX notification event type sent on begin of the server shutdown */
    public final String STOP_NOTIFICATION_TYPE = "org.jboss.system.server.stopped";
 
+   /** The server start date */
+   Date getStartDate();
+   
+   /** The server version */
+   String getVersion();
+
+   /** The server version code name */
+   String getVersionName();
+
+   /** The date the server was build (compiled) */
+   String getBuildNumber();
+
+   /** The JVM used to build the server */
+   String getBuildJVM();
+
+   /** The Operating System used to build the server */
+   String getBuildOS();
+
+   /** The build id */
+   String getBuildID();
+
+   /** The date the server was build */
+   String getBuildDate();
+   
+   /** A flag indicating if shutdown has been called */
+   boolean isInShutdown();
+
+   // Operations ----------------------------------------------------
+   
+
    /**
     * Initialize the Server instance.
     *
@@ -88,6 +121,10 @@
     * @param exitcode   The exit code returned to the operating system.
     */
    void exit(int exitcode);
+   /**
+    * Shutdown the server, the JVM and run shutdown hooks. Exits with code 1.
+    */
+   void exit();
 
    /** 
     * Forcibly terminates the currently running Java virtual machine.
@@ -95,4 +132,8 @@
     * @param exitcode   The exit code returned to the operating system.
     */
    void halt(int exitcode);
+   /**
+    * Forcibly terminates the currently running Java virtual machine. Exits with code 1.
+    */
+   void halt();
 }

Modified: branches/MC_VDF_WORK/system/src/main/org/jboss/system/server/profileservice/ProfileServiceBootstrap.java
===================================================================
--- branches/MC_VDF_WORK/system/src/main/org/jboss/system/server/profileservice/ProfileServiceBootstrap.java	2006-08-09 05:11:54 UTC (rev 55432)
+++ branches/MC_VDF_WORK/system/src/main/org/jboss/system/server/profileservice/ProfileServiceBootstrap.java	2006-08-09 12:01:57 UTC (rev 55433)
@@ -24,15 +24,27 @@
 import java.net.URL;
 import java.util.Enumeration;
 
+import org.jboss.beans.info.spi.BeanInfo;
+import org.jboss.beans.metadata.plugins.AbstractBeanMetaData;
+import org.jboss.beans.metadata.spi.BeanMetaData;
+import org.jboss.dependency.plugins.AbstractControllerContext;
+import org.jboss.dependency.spi.ControllerState;
 import org.jboss.deployers.spi.Deployment;
 import org.jboss.deployers.spi.MainDeployer;
+import org.jboss.kernel.Kernel;
 import org.jboss.kernel.plugins.bootstrap.basic.BasicBootstrap;
+import org.jboss.kernel.plugins.dependency.AbstractKernelControllerContext;
+import org.jboss.kernel.plugins.dependency.KernelControllerContextActions;
 import org.jboss.kernel.plugins.deployment.xml.BasicXMLDeployer;
+import org.jboss.kernel.plugins.registry.AbstractKernelRegistryEntry;
+import org.jboss.kernel.spi.config.KernelConfigurator;
+import org.jboss.kernel.spi.dependency.KernelController;
 import org.jboss.kernel.spi.registry.KernelRegistry;
 import org.jboss.kernel.spi.registry.KernelRegistryEntry;
 import org.jboss.profileservice.spi.Profile;
 import org.jboss.profileservice.spi.ProfileKey;
 import org.jboss.profileservice.spi.ProfileService;
+import org.jboss.system.server.Server;
 
 /**
  * An extension of the kernel basic bootstrap that boots the mc from
@@ -47,6 +59,8 @@
    public static String DEPLOYERS_XML_NAME = "deployer-beans.xml";
    /** The name of the profile that is being booted */
    protected String profileName;
+   /** The Server instance bootstraping the profile service */
+   protected Server server;
    /** The kernel deployer used to load the server deployers */
    protected BasicXMLDeployer kernelDeployer;
    /** The server MainDeployer */
@@ -57,13 +71,15 @@
    /** An explicit deployer-beans.xml URL to deploy */
    protected URL bootstrapURL;
 
-   public ProfileServiceBootstrap()
+   public ProfileServiceBootstrap(String name, Server server)
    {
-      this("default");
+      this.profileName = name;
+      this.server = server;
    }
-   public ProfileServiceBootstrap(String name)
+
+   public Server getServer()
    {
-      this.profileName = name;
+      return server;
    }
 
    /**
@@ -165,11 +181,20 @@
     	  deploy(bootstrapURL);    	  
       }
 
+      // Register the Server instance in the kernel
+      Kernel kernel = getKernel();
+      KernelController controller = kernel.getController();
+      KernelRegistry registry = kernel.getRegistry();
+      KernelConfigurator config = kernel.getConfigurator();
+      BeanInfo info = config.getBeanInfo(server.getClass());;
+      AbstractBeanMetaData metaData = new AbstractBeanMetaData("org.jboss.system.server.Server", null);
+      AbstractKernelControllerContext serverEntry = new AbstractKernelControllerContext(info, metaData, server);
+      controller.install(serverEntry);
+ 
       // Validate that everything is ok
       kernelDeployer.validate();
 
       // Get the MainDeployer
-      KernelRegistry registry = getKernel().getRegistry();
       KernelRegistryEntry mdEntry = registry.getEntry("MainDeployer");
       Object target = mdEntry.getTarget();
       if( target instanceof MainDeployer )

Modified: branches/MC_VDF_WORK/system/src/main/org/jboss/system/server/profileservice/ServerImpl.java
===================================================================
--- branches/MC_VDF_WORK/system/src/main/org/jboss/system/server/profileservice/ServerImpl.java	2006-08-09 05:11:54 UTC (rev 55432)
+++ branches/MC_VDF_WORK/system/src/main/org/jboss/system/server/profileservice/ServerImpl.java	2006-08-09 12:01:57 UTC (rev 55433)
@@ -73,6 +73,10 @@
 
    /** Flag to indicate if we are started. */
    private boolean started;
+   /** A flag indicating if start has been called */
+   private boolean isInStart;
+   /** A flag indicating if shutdown has been called */
+   private boolean isInShutdown;
 
    /** The JVM shutdown hook */
    private ShutdownHook shutdownHook;
@@ -274,6 +278,16 @@
    }
 
    /**
+    Check if the shutdown operation has been called/is in progress.
+
+    @return true if shutdown has been called, false otherwise
+    */
+   public boolean isInShutdown()
+   {
+      return isInShutdown;
+   }
+
+   /**
     * Start the Server instance.
     *
     * @throws IllegalStateException    Already started or not initialized.
@@ -281,6 +295,19 @@
     */
    public void start() throws IllegalStateException, Exception
    {
+      synchronized( this )
+      {
+         if( isInStart == false )
+         {
+            isInStart = true;
+         }
+         else
+         {
+            log.debug("Already in start, ignoring duplicate start");
+            return;
+         }
+      }
+
       // make sure we are initialized
       getConfig();
 
@@ -309,6 +336,7 @@
       finally
       {
          Thread.currentThread().setContextClassLoader(oldCL);
+         isInStart = false;
       }
    }
 
@@ -326,7 +354,7 @@
       // remeber when we we started
       startDate = new Date();
 
-      bootstrap = new ProfileServiceBootstrap(config.getServerName());
+      bootstrap = new ProfileServiceBootstrap(config.getServerName(), this);
       if( deployerBeansPrefix != null )
       {
          bootstrap.setDeployerBeansPrefix(deployerBeansPrefix);
@@ -400,6 +428,7 @@
 
       log.debug("Shutting down");
 
+      isInShutdown = true;
       boolean exitOnShutdown = config.getExitOnShutdown();
       boolean blockingShutdown = config.getBlockingShutdown();
 




More information about the jboss-cvs-commits mailing list