[jboss-cvs] JBossAS SVN: r58576 - trunk/cluster/src/main/org/jboss/ha/framework/server

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Sat Nov 18 06:36:37 EST 2006


Author: bstansberry at jboss.com
Date: 2006-11-18 06:36:36 -0500 (Sat, 18 Nov 2006)
New Revision: 58576

Modified:
   trunk/cluster/src/main/org/jboss/ha/framework/server/FarmMemberService.java
Log:
Just inject HAPartition

Modified: trunk/cluster/src/main/org/jboss/ha/framework/server/FarmMemberService.java
===================================================================
--- trunk/cluster/src/main/org/jboss/ha/framework/server/FarmMemberService.java	2006-11-18 11:35:02 UTC (rev 58575)
+++ trunk/cluster/src/main/org/jboss/ha/framework/server/FarmMemberService.java	2006-11-18 11:36:36 UTC (rev 58576)
@@ -25,9 +25,8 @@
 import java.net.MalformedURLException;
 import java.net.URL;
 import java.util.*;
-import javax.management.MBeanServer;
-import javax.management.ObjectName;
 
+import org.jboss.deployment.Deployer;
 import org.jboss.deployment.scanner.URLDeploymentScanner;
 import org.jboss.ha.framework.interfaces.HAPartition;
 import org.jboss.system.server.ServerConfig;
@@ -52,10 +51,9 @@
  */
 public class FarmMemberService extends URLDeploymentScanner implements FarmMemberServiceMBean
 {
-   private MBeanServer mServer;
-   protected ObjectName mClusterPartitionName = null;
    protected ClusterPartitionMBean mClusterPartition = null;
    protected String mBackgroundPartition = ServerConfigUtil.getDefaultPartitionName();
+   protected HAPartition mHAPartition;
    private File mTempDirectory;
    private ClusterFileTransfer mFileTransfer;
 
@@ -72,10 +70,7 @@
    
    public void setPartitionName( String pPartitionName )
    {
-      if( ( getState () != STARTED ) && ( getState () != STARTING ) )
-      {
-         mBackgroundPartition = pPartitionName;
-      }
+      log.warn("setPartitionName does nothing; use setClusterPartition");
    }
 
    public ClusterPartitionMBean getClusterPartition()
@@ -116,17 +111,6 @@
    }
    
    /**
-    * Saves the MBeanServer reference, create the Farm Member Name and
-    * add its Notification Listener to listen for Deployment / Undeployment
-    * notifications from the {@link org.jboss.deployment.MainDeployer MainDeployer}.
-    */
-   public ObjectName preRegister( MBeanServer pServer, ObjectName pName )
-      throws Exception
-   {
-      mServer = pServer;
-      return super.preRegister(pServer, pName);
-   }
-   /**
     * Looks up the Server Config instance to figure out the
     * temp-directory and the farm-deploy-directory
     **/
@@ -149,30 +133,19 @@
       {
          log.debug( "registerRPCHandler" );
          
-         HAPartition lHAPartition = null;
-         if (mClusterPartition != null)
+         if (mClusterPartition == null)
          {
-            lHAPartition = mClusterPartition.getHAPartition();
-            mBackgroundPartition = lHAPartition.getPartitionName();
+            throw new IllegalStateException("Must set the ClusterPartition property before calling start");
          }
          
-         mClusterPartitionName = new ObjectName( "jboss:service=" + mBackgroundPartition );
+         mHAPartition = mClusterPartition.getHAPartition();
+         mBackgroundPartition = mHAPartition.getPartitionName();
          
-         if (lHAPartition == null)
-         {
-            // Old style config with PartitionName was used -- have to
-            // look up the partition in JMX
-            lHAPartition = (HAPartition) mServer.getAttribute(
-               mClusterPartitionName,
-               "HAPartition"
-            );
-         }
-         
-         lHAPartition.registerRPCHandler( SERVICE_NAME, this );
+         mHAPartition.registerRPCHandler( SERVICE_NAME, this );
 
-         mFileTransfer = new ClusterFileTransfer(lHAPartition, buildParentFolderMapping());
+         mFileTransfer = new ClusterFileTransfer(mHAPartition, buildParentFolderMapping());
 
-         ArrayList response = lHAPartition.callMethodOnCoordinatorNode(
+         ArrayList response = mHAPartition.callMethodOnCoordinatorNode(
             SERVICE_NAME,
             "farmDeployments",
             new Object[] {}, new Class[] {},
@@ -186,7 +159,7 @@
             if ( map != null && map instanceof HashMap )
             {
                HashMap farmed = (HashMap) map;
-               pullNewDeployments(lHAPartition, farmed);
+               pullNewDeployments(mHAPartition, farmed);
             }
          }
 
@@ -418,13 +391,10 @@
          if (!consequenceOfRemoteCall)
          {
             Date fileDate = new Date(file.lastModified());
-            HAPartition lHAPartition = (HAPartition) mServer.getAttribute(
-               mClusterPartitionName,
-               "HAPartition"
-               );
+            
             this.mFileTransfer.push(file, parent.getName(), true);
 
-            lHAPartition.callMethodOnCluster(
+            mHAPartition.callMethodOnCluster(
                SERVICE_NAME,
                "farmDeploy",
                new Object[] {parent.getName(), file, fileDate},
@@ -474,11 +444,7 @@
          
          if (!consequenceOfRemoteCall)
          {
-            HAPartition lHAPartition = (HAPartition) mServer.getAttribute(
-               mClusterPartitionName,
-               "HAPartition"
-               );
-            lHAPartition.callMethodOnCluster(
+            mHAPartition.callMethodOnCluster(
                SERVICE_NAME,
                "farmUndeploy",
                new Object[] {parentName, fileName},




More information about the jboss-cvs-commits mailing list