[hornetq-commits] JBoss hornetq SVN: r9543 - 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
Fri Aug 13 11:03:08 EDT 2010


Author: jmesnil
Date: 2010-08-13 11:03:07 -0400 (Fri, 13 Aug 2010)
New Revision: 9543

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/ServerLocatorInternal.java
   branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/server/cluster/impl/ClusterConnectionImpl.java
Log:
HA refactoring

* do *not* notify that nodes are UP or DOWN when the discovery group notifies the server locator that its connector has changed

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-08-13 15:01:37 UTC (rev 9542)
+++ branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/client/impl/ServerLocatorImpl.java	2010-08-13 15:03:07 UTC (rev 9543)
@@ -426,9 +426,10 @@
       initialise();
    }
    
-   public void connect(boolean backup, TransportConfiguration transportConfig)
+   public void connect()
    {
-      if (initialConnectors != null)
+      // static list of initial connectors
+      if (initialConnectors != null && discoveryGroup == null)
       {
          for (TransportConfiguration connector : initialConnectors)
          {
@@ -454,6 +455,18 @@
             while (sf == null);
          }
       }
+      // wait for discovery group to get the list of initial connectors
+      else
+      {
+         try
+         {
+            ClientSessionFactory sf = createSessionFactory();
+         }
+         catch (Exception e)
+         {
+            e.printStackTrace();
+         }
+      }
    }
    
    public ClientSessionFactory createSessionFactory(final TransportConfiguration transportConfiguration) throws Exception
@@ -1123,6 +1136,7 @@
 
       for (ClusterTopologyListener listener : topologyListeners)
       {
+         System.out.println(this.nodeID + " notified that " + nodeID + " is UP");
          listener.nodeUP(nodeID, connectorPair, last);
       }
 
@@ -1158,8 +1172,6 @@
       for (DiscoveryEntry entry : newConnectors)
       {
          this.initialConnectors[count++] = entry.getConnector();
-
-         notifyNodeUp(entry.getNodeID(), new Pair<TransportConfiguration, TransportConfiguration>(entry.getConnector(), null), true);
       }
       
       System.out.println(">>>>>>>> Discovered initial connectors= " + Arrays.asList(initialConnectors));

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-08-13 15:01:37 UTC (rev 9542)
+++ branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/client/impl/ServerLocatorInternal.java	2010-08-13 15:03:07 UTC (rev 9543)
@@ -36,7 +36,7 @@
 
    void setNodeID(String nodeID);
    
-   void connect(boolean backup, TransportConfiguration transportConfig);
+   void connect();
    
    void addClusterTopologyListener(ClusterTopologyListener listener);
    

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-08-13 15:01:37 UTC (rev 9542)
+++ branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/server/cluster/impl/ClusterConnectionImpl.java	2010-08-13 15:03:07 UTC (rev 9543)
@@ -173,13 +173,19 @@
       {
          serverLocator.addClusterTopologyListener(this);
          serverLocator.start();
-
          // FIXME Ugly ugly code to connect to other nodes and form the cluster... :(
          server.getExecutorFactory().getExecutor().execute(new Runnable()
          {
             public void run()
             {
-               serverLocator.connect(server.getConfiguration().isBackup(), connector);
+               try
+               {
+                  serverLocator.connect();
+               }
+               catch (Exception e)
+               {
+                  e.printStackTrace();
+               }
             }
          });
       }



More information about the hornetq-commits mailing list