[hornetq-commits] JBoss hornetq SVN: r9469 - in branches/2_2_0_HA_Improvements/src/main/org/hornetq/core: server/cluster/impl and 1 other directory.

do-not-reply at jboss.org do-not-reply at jboss.org
Tue Jul 27 05:55:27 EDT 2010


Author: jmesnil
Date: 2010-07-27 05:55:27 -0400 (Tue, 27 Jul 2010)
New Revision: 9469

Modified:
   branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/client/impl/ClientSessionFactoryImpl.java
   branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/client/impl/ServerLocatorImpl.java
   branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/client/impl/ServerLocatorInternal.java
   branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/server/cluster/impl/ClusterConnectionImpl.java
Log:
HA refactoring

* added clusterConnection attribute to ServerLocatorInternal to distinguish between regular connection and cluster connections when creating the server resources in CoreProtocolManager.createConnectionEntry()
* the clusterConnection attribute is set to true only in ClusterConnectionImpl constructor

Modified: branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/client/impl/ClientSessionFactoryImpl.java
===================================================================
--- branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/client/impl/ClientSessionFactoryImpl.java	2010-07-27 09:52:35 UTC (rev 9468)
+++ branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/client/impl/ClientSessionFactoryImpl.java	2010-07-27 09:55:27 UTC (rev 9469)
@@ -1064,7 +1064,7 @@
          
          if (serverLocator.isHA())
          {
-            channel0.send(new SubscribeClusterTopologyUpdatesMessage(false));
+            channel0.send(new SubscribeClusterTopologyUpdatesMessage(serverLocator.isClusterConnection()));
          }
       }
 

Modified: branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/client/impl/ServerLocatorImpl.java
===================================================================
--- branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/client/impl/ServerLocatorImpl.java	2010-07-27 09:52:35 UTC (rev 9468)
+++ branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/client/impl/ServerLocatorImpl.java	2010-07-27 09:55:27 UTC (rev 9469)
@@ -62,6 +62,8 @@
 
    private final boolean ha;
 
+   private boolean clusterConnection;
+   
    private final String discoveryAddress;
 
    private final int discoveryPort;
@@ -376,6 +378,8 @@
       initialMessagePacketSize = HornetQClient.DEFAULT_INITIAL_MESSAGE_PACKET_SIZE;
 
       cacheLargeMessagesClient = HornetQClient.DEFAULT_CACHE_LARGE_MESSAGE_CLIENT;
+      
+      clusterConnection = false;
    }
 
    /**
@@ -989,6 +993,16 @@
       this.nodeID = nodeID;
    }
 
+   public void setClusterConnection(boolean clusterConnection)
+   {
+      this.clusterConnection = clusterConnection;
+   }
+   
+   public boolean isClusterConnection()
+   {
+      return clusterConnection;
+   }
+
    @Override
    protected void finalize() throws Throwable
    {

Modified: branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/client/impl/ServerLocatorInternal.java
===================================================================
--- branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/client/impl/ServerLocatorInternal.java	2010-07-27 09:52:35 UTC (rev 9468)
+++ branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/client/impl/ServerLocatorInternal.java	2010-07-27 09:55:27 UTC (rev 9469)
@@ -45,4 +45,8 @@
    void notifyNodeUp(String nodeID, Pair<TransportConfiguration, TransportConfiguration> connectorPair, boolean last);
    
    void notifyNodeDown(String nodeID);
+
+   void setClusterConnection(boolean clusterConnection);
+
+   boolean isClusterConnection();
 }

Modified: branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/server/cluster/impl/ClusterConnectionImpl.java
===================================================================
--- branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/server/cluster/impl/ClusterConnectionImpl.java	2010-07-27 09:52:35 UTC (rev 9468)
+++ branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/server/cluster/impl/ClusterConnectionImpl.java	2010-07-27 09:55:27 UTC (rev 9469)
@@ -119,8 +119,18 @@
                                 final String clusterUser,
                                 final String clusterPassword) throws Exception
    {
+
+      if (nodeUUID == null)
+      {
+         throw new IllegalArgumentException("node id is null");
+      }
+
+      this.nodeUUID = nodeUUID;
+      
       this.serverLocator = serverLocator;
-      
+
+      this.serverLocator.setClusterConnection(true);
+
       this.connector = connector;
 
       this.name = name;
@@ -143,13 +153,6 @@
 
       this.maxHops = maxHops;
 
-      if (nodeUUID == null)
-      {
-         throw new IllegalArgumentException("node id is null");
-      }
-
-      this.nodeUUID = nodeUUID;
-
       this.backup = backup;
 
       this.clusterUser = clusterUser;



More information about the hornetq-commits mailing list