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

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Sep 14 17:42:39 EDT 2007


Author: bstansberry at jboss.com
Date: 2007-09-14 17:42:39 -0400 (Fri, 14 Sep 2007)
New Revision: 65410

Modified:
   trunk/cluster/src/main/org/jboss/ha/framework/server/ClusterPartition.java
Log:
[JBAS-4724] DRM lifecycle must be controlled by ClusterPartition
[JBAS-4726] DistributedStateImpl does not subclass ServiceMBeanSupport
Don't inject DS via the config object
Create the channel in start()

Modified: trunk/cluster/src/main/org/jboss/ha/framework/server/ClusterPartition.java
===================================================================
--- trunk/cluster/src/main/org/jboss/ha/framework/server/ClusterPartition.java	2007-09-14 21:40:54 UTC (rev 65409)
+++ trunk/cluster/src/main/org/jboss/ha/framework/server/ClusterPartition.java	2007-09-14 21:42:39 UTC (rev 65410)
@@ -177,7 +177,9 @@
    /** The JGroups partition channel */
    protected Channel channel;
    /** The cluster replicant manager */
-   protected DistributedReplicantManager replicantManager;
+   protected DistributedReplicantManagerImpl replicantManager;
+   /** The DistributedState service we manage */
+   protected DistributedStateImpl distributedState;
    /** The cluster instance log category */
    protected Logger log;
    protected Logger clusterLifeCycleLog;   
@@ -247,6 +249,28 @@
    {
       if (config == null)
          throw new IllegalArgumentException("config cannot be null");
+      
+      if (replicantManager == null)
+         throw new IllegalStateException("DistributedReplicantManager property must be set before creating ClusterPartition service");
+      
+      replicantManager.createService();
+      
+      if (distributedState != null)
+      {
+         distributedState.setClusteredCache(getClusteredCache());
+         distributedState.createService();
+      }         
+      
+      // Create the asynchronous handler for view changes
+      asynchHandler = new AsynchEventHandler(this, "AsynchViewChangeHandler");
+      
+      log.debug("done initializing partition");
+   }
+   
+   protected void startService() throws Exception
+   {
+      logHistory ("Starting partition");
+      
       log.debug("Creating Multiplexer Channel for partition " + getPartitionName() +
             " using stack " + getMultiplexerStack());
 
@@ -268,19 +292,6 @@
       dispatcher.setRequestMarshaller(new RequestMarshallerImpl());
       dispatcher.setResponseMarshaller(new ResponseMarshallerImpl());
       
-      if (replicantManager == null)
-         throw new IllegalStateException("DistributedReplicantManager property must be set before creating ClusterPartition service");
-
-      // Create the asynchronous handler for view changes
-      asynchHandler = new AsynchEventHandler(this, "AsynchViewChangeHandler");
-      
-      log.debug("done initializing partition");
-   }
-   
-   protected void startService() throws Exception
-   {
-      logHistory ("Starting partition");
-      
       // Store our uniqueId in the channel
       configureUniqueId();
       
@@ -322,6 +333,13 @@
          //
          fetchState();
          
+         replicantManager.startService();
+         
+         if (distributedState != null)
+         {
+            distributedState.startService();
+         }
+         
          // Start the asynch listener handler thread
          asynchHandler.start();
          
@@ -355,7 +373,14 @@
       {
          log.warn("Failed to stop asynchHandler", e);
       }    
+      
+      if (distributedState != null)
+      {
+         distributedState.stopService();
+      }
 
+      replicantManager.stopService();
+      
 //    NR 200505 : [JBCLUSTER-38] replace channel.close() by a disconnect and
 //    add the destroyPartition() step
       try
@@ -393,8 +418,15 @@
    
    protected void destroyService()  throws Exception
    {
-      log.debug("Destroying HAPartition: " + getPartitionName());
+      log.debug("Destroying HAPartition: " + getPartitionName()); 
+      
+      if (distributedState != null)
+      {
+         distributedState.destroyService();
+      }   
 
+      replicantManager.destroyService();
+
       try
       {
          channel.close();
@@ -739,7 +771,7 @@
    
    public DistributedState getDistributedStateService()
    {
-      return config.getDistributedState();
+      return distributedState;
    }
 
    public long getCurrentViewId()
@@ -1048,12 +1080,21 @@
    
    // Public ------------------------------------------------------------------
    
-   public void setDistributedReplicantManager(DistributedReplicantManager drm)
+   public void setDistributedStateImpl(DistributedStateImpl distributedState)
    {
+      this.distributedState = distributedState;      
+   }
+   
+   public void setDistributedReplicantManagerImpl(DistributedReplicantManagerImpl drm)
+   {
       if (this.replicantManager != null  && !(replicantManager == drm))
          throw new IllegalStateException("DistributedReplicantManager already set");
 
       this.replicantManager = drm;
+      if (this.replicantManager != null)
+      {
+         this.replicantManager.setHAPartition(this);
+      }
    }
    
    




More information about the jboss-cvs-commits mailing list