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

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Feb 1 17:30:13 EST 2008


Author: bstansberry at jboss.com
Date: 2008-02-01 17:30:13 -0500 (Fri, 01 Feb 2008)
New Revision: 69549

Modified:
   trunk/cluster/src/main/org/jboss/ha/framework/server/ClusterPartition.java
   trunk/cluster/src/main/org/jboss/ha/framework/server/ClusterPartitionConfig.java
Log:
Revert JBAS-5167 changes

Modified: trunk/cluster/src/main/org/jboss/ha/framework/server/ClusterPartition.java
===================================================================
--- trunk/cluster/src/main/org/jboss/ha/framework/server/ClusterPartition.java	2008-02-01 21:42:21 UTC (rev 69548)
+++ trunk/cluster/src/main/org/jboss/ha/framework/server/ClusterPartition.java	2008-02-01 22:30:13 UTC (rev 69549)
@@ -270,12 +270,7 @@
       log.debug("Creating Multiplexer Channel for partition " + getPartitionName() +
             " using stack " + getMultiplexerStack());
 
-      channel = config.getChannel();
-      if (channel == null)
-      {
-         channel = createMuxChannel(config);
-         config.setChannel(channel);
-      }
+      channel = createMuxChannel(config);
       
       channel.setOpt(Channel.AUTO_RECONNECT, Boolean.TRUE);
       channel.setOpt(Channel.AUTO_GETSTATE, Boolean.TRUE);
@@ -331,7 +326,8 @@
       catch (Throwable t)
       {
          log.debug("Caught exception after channel connected; closing channel -- " + t.getLocalizedMessage());
-         channel.disconnect();
+         channel.close();
+         channel = null;
          throw (t instanceof Exception) ? (Exception) t : new RuntimeException(t);
       }
       
@@ -362,7 +358,7 @@
 //    add the destroyPartition() step
       try
       {
-         if (channel.isConnected())
+         if (channel != null && channel.isConnected())
             channel.disconnect();
       }
       catch (Exception e)
@@ -391,7 +387,7 @@
          NonSerializableFactory.unbind (boundName);         
       }
 
-     log.info("Partition " + getPartitionName() + " stopped.");
+      log.info("Partition " + getPartitionName() + " stopped.");
    }
    
    protected void destroyService()  throws Exception
@@ -407,7 +403,8 @@
 
       try
       {
-         channel.close();
+         if (channel != null && channel.isOpen())
+            channel.close();
       }
       catch (Exception e)
       {

Modified: trunk/cluster/src/main/org/jboss/ha/framework/server/ClusterPartitionConfig.java
===================================================================
--- trunk/cluster/src/main/org/jboss/ha/framework/server/ClusterPartitionConfig.java	2008-02-01 21:42:21 UTC (rev 69548)
+++ trunk/cluster/src/main/org/jboss/ha/framework/server/ClusterPartitionConfig.java	2008-02-01 22:30:13 UTC (rev 69549)
@@ -25,8 +25,8 @@
 
 import org.jboss.cache.Cache;
 import org.jboss.cache.config.Configuration;
+import org.jboss.ha.framework.interfaces.DistributedState;
 import org.jboss.system.server.ServerConfigUtil;
-import org.jgroups.Channel;
 import org.jgroups.ChannelFactory;
 
 /**
@@ -43,8 +43,8 @@
    // Attributes ----------------------------------------------------
 
    private   Cache cache;
-   private   Channel channel;
    private   ChannelFactory multiplexer;
+   private   DistributedState distributedState;
    private   String stackName;
    private   String partitionName = ServerConfigUtil.getDefaultPartitionName();
    private   boolean deadlock_detection = false;
@@ -138,17 +138,7 @@
    {
       this.allow_sync_events = allowSync;
    }
-   
-   public Channel getChannel()
-   {
-      return channel;
-   }
 
-   public void setChannel(Channel channel)
-   {
-      this.channel = channel;
-   }
-
    public ChannelFactory getMultiplexer()
    {
       return multiplexer;
@@ -178,7 +168,11 @@
    {
       this.cache = cache;
       Configuration config = cache.getConfiguration();
-      this.multiplexer = config.getRuntimeConfig().getMuxChannelFactory();
+      multiplexer = config.getRuntimeConfig().getMuxChannelFactory();
+      
+      if (multiplexer == null)
+         throw new IllegalArgumentException("Cache not configured for a multiplexer");
+      
       this.stackName = config.getMultiplexerStack();
    }
 
@@ -191,4 +185,14 @@
    {
       this.namingServicePort = namingServicePort;
    }
+
+   public DistributedState getDistributedState()
+   {
+      return distributedState;
+   }
+
+   public void setDistributedState(DistributedState distributedState)
+   {
+      this.distributedState = distributedState;
+   }
 }




More information about the jboss-cvs-commits mailing list