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

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Mar 19 18:10:06 EDT 2009


Author: bstansberry at jboss.com
Date: 2009-03-19 18:10:06 -0400 (Thu, 19 Mar 2009)
New Revision: 86134

Modified:
   trunk/cluster/src/main/org/jboss/ha/framework/server/ClusterPartition.java
Log:
Expose hook to allows tests to inject channel

Modified: trunk/cluster/src/main/org/jboss/ha/framework/server/ClusterPartition.java
===================================================================
--- trunk/cluster/src/main/org/jboss/ha/framework/server/ClusterPartition.java	2009-03-19 22:05:18 UTC (rev 86133)
+++ trunk/cluster/src/main/org/jboss/ha/framework/server/ClusterPartition.java	2009-03-19 22:10:06 UTC (rev 86134)
@@ -39,10 +39,6 @@
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.CountDownLatch;
 
-import javax.management.JMException;
-import javax.management.MBeanServer;
-import javax.management.MalformedObjectNameException;
-import javax.management.ObjectName;
 import javax.naming.Context;
 import javax.naming.InitialContext;
 import javax.naming.Name;
@@ -282,32 +278,6 @@
    private KernelControllerContext kernelControllerContext;
 
    // Static --------------------------------------------------------
-   
-   private Channel createChannel()
-   {
-      ChannelFactory factory = this.getChannelFactory();
-      if (factory == null)
-      {
-         throw new IllegalStateException("HAPartitionConfig has no JChannelFactory");
-      }
-      String stack = this.getChannelStackName();
-      if (stack == null)
-      {
-         throw new IllegalStateException("HAPartitionConfig has no multiplexer stack");
-      }
-      try
-      {
-         return factory.createMultiplexerChannel(stack, this.getPartitionName());
-      }
-      catch (RuntimeException e)
-      {
-         throw e;
-      }
-      catch (Exception e)
-      {
-         throw new RuntimeException("Failure creating multiplexed Channel", e);
-      }
-   }
 
     // Constructors --------------------------------------------------
    
@@ -352,9 +322,12 @@
       this.logHistory ("Starting partition");
       
       // Have the handler get the cache
-      this.cacheHandler.acquireCache();
-      this.channelFactory = this.cacheHandler.getCacheChannelFactory();
-      this.stackName = this.cacheHandler.getChannelStackName();
+      if (this.cacheHandler != null)
+      {
+         this.cacheHandler.acquireCache();
+         this.channelFactory = this.cacheHandler.getCacheChannelFactory();
+         this.stackName = this.cacheHandler.getChannelStackName();
+      }
       
       if (this.channel == null || !this.channel.isOpen())
       {
@@ -397,7 +370,10 @@
          this.threadPool.run(task);
       }
       
-      this.cacheHandler.startCache();
+      if (this.cacheHandler != null)
+      {
+         this.cacheHandler.startCache();
+      }
       
       try
       {
@@ -475,14 +451,17 @@
 
       this.replicantManager.stopService();
       
-      try
+      if (this.cacheHandler != null)
       {
-         this.cacheHandler.releaseCache();
+         try
+         {
+            this.cacheHandler.releaseCache();
+         }
+         catch (Exception e)
+         {
+            this.log.error("cache release failed", e);
+         }
       }
-      catch (Exception e)
-      {
-         this.log.error("cache release failed", e);
-      }
       
 //    NR 200505 : [JBCLUSTER-38] replace channel.close() by a disconnect and
 //    add the destroyPartition() step
@@ -1450,6 +1429,32 @@
    }   
    
    // Protected -----------------------------------------------------
+   
+   protected Channel createChannel()
+   {
+      ChannelFactory factory = this.getChannelFactory();
+      if (factory == null)
+      {
+         throw new IllegalStateException("HAPartitionConfig has no JChannelFactory");
+      }
+      String stack = this.getChannelStackName();
+      if (stack == null)
+      {
+         throw new IllegalStateException("HAPartitionConfig has no multiplexer stack");
+      }
+      try
+      {
+         return factory.createMultiplexerChannel(stack, this.getPartitionName());
+      }
+      catch (RuntimeException e)
+      {
+         throw e;
+      }
+      catch (Exception e)
+      {
+         throw new RuntimeException("Failure creating multiplexed Channel", e);
+      }
+   }
 
    protected void verifyNodeIsUnique () throws IllegalStateException
    {




More information about the jboss-cvs-commits mailing list