[hornetq-commits] JBoss hornetq SVN: r11561 - in branches/Branch_2_2_EAP: src/main/org/hornetq/core/postoffice/impl and 2 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Mon Oct 17 22:38:13 EDT 2011


Author: clebert.suconic at jboss.com
Date: 2011-10-17 22:38:12 -0400 (Mon, 17 Oct 2011)
New Revision: 11561

Modified:
   branches/Branch_2_2_EAP/src/main/org/hornetq/core/client/impl/ServerLocatorImpl.java
   branches/Branch_2_2_EAP/src/main/org/hornetq/core/postoffice/impl/PostOfficeImpl.java
   branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/cluster/impl/ClusterConnectionImpl.java
   branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/distribution/MessageRedistributionTest.java
   branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/distribution/TwoWayTwoNodeClusterTest.java
Log:
fixing tests

Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/core/client/impl/ServerLocatorImpl.java
===================================================================
--- branches/Branch_2_2_EAP/src/main/org/hornetq/core/client/impl/ServerLocatorImpl.java	2011-10-17 19:18:17 UTC (rev 11560)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/core/client/impl/ServerLocatorImpl.java	2011-10-18 02:38:12 UTC (rev 11561)
@@ -79,9 +79,9 @@
 
    private final Topology topology;
 
-   private Pair<TransportConfiguration, TransportConfiguration>[] topologyArray;
+   private volatile Pair<TransportConfiguration, TransportConfiguration>[] topologyArray;
 
-   private boolean receivedTopology;
+   private volatile boolean receivedTopology;
 
    private boolean compressLargeMessage;
 
@@ -505,7 +505,7 @@
       this(topology, useHA, null, transportConfigs);
    }
 
-   private TransportConfiguration selectConnector()
+   private synchronized TransportConfiguration selectConnector()
    {
       if (receivedTopology)
       {
@@ -1290,23 +1290,23 @@
 
       if (topology.removeMember(eventTime, nodeID))
       {
-         if (topology.isEmpty())
+         synchronized (this)
          {
-            // Resetting the topology to its original condition as it was brand new
-            synchronized (this)
+            if (topology.isEmpty())
             {
-               topologyArray = null;
+               // Resetting the topology to its original condition as it was brand new
                receivedTopology = false;
+               topologyArray = null;
             }
-         }
-         else
-         {
-            updateArraysAndPairs();
-
-            if (topology.nodes() == 1 && topology.getMember(this.nodeID) != null)
+            else
             {
-               // Resetting the topology to its original condition as it was brand new
-               receivedTopology = false;
+               updateArraysAndPairs(false);
+
+               if (topology.nodes() == 1 && topology.getMember(this.nodeID) != null)
+               {
+                  // Resetting the topology to its original condition as it was brand new
+                  receivedTopology = false;
+               }
             }
          }
       }
@@ -1345,18 +1345,8 @@
             }
          }
 
-         updateArraysAndPairs();
+         updateArraysAndPairs(last);
       }
-
-      if (last)
-      {
-         synchronized (this)
-         {
-            receivedTopology = true;
-            // Notify if waiting on getting topology
-            notifyAll();
-         }
-      }
    }
 
    /* (non-Javadoc)
@@ -1383,7 +1373,7 @@
       }
    }
 
-   private synchronized void updateArraysAndPairs()
+   private synchronized void updateArraysAndPairs(final boolean updateReceived)
    {
       Collection<TopologyMember> membersCopy = topology.getMembers();
 
@@ -1395,6 +1385,12 @@
       {
          topologyArray[count++] = pair.getConnector();
       }
+
+      if (updateReceived)
+      {
+         receivedTopology = true;
+         notifyAll();
+      }
    }
 
    public synchronized void connectorsChanged()

Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/core/postoffice/impl/PostOfficeImpl.java
===================================================================
--- branches/Branch_2_2_EAP/src/main/org/hornetq/core/postoffice/impl/PostOfficeImpl.java	2011-10-17 19:18:17 UTC (rev 11560)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/core/postoffice/impl/PostOfficeImpl.java	2011-10-18 02:38:12 UTC (rev 11561)
@@ -473,9 +473,9 @@
 
       String uid = UUIDGenerator.getInstance().generateStringUUID();
       
-      if (isTrace)
+      if (log.isDebugEnabled())
       {
-         log.trace("Sending notification for addBinding " + binding + " from server " + server);
+         log.debug("ClusterCommunication::Sending notification for addBinding " + binding + " from server " + server);
       }
 
       managementService.sendNotification(new Notification(uid, NotificationType.BINDING_ADDED, props));

Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/cluster/impl/ClusterConnectionImpl.java
===================================================================
--- branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/cluster/impl/ClusterConnectionImpl.java	2011-10-17 19:18:17 UTC (rev 11560)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/cluster/impl/ClusterConnectionImpl.java	2011-10-18 02:38:12 UTC (rev 11561)
@@ -1135,9 +1135,9 @@
 
       public synchronized void onMessage(final ClientMessage message)
       {
-         if (isTrace)
+         if (log.isDebugEnabled())
          {
-            log.trace("Flow record on " + clusterConnector + " Receiving message " + message);
+            log.debug("ClusterCommunication::Flow record on " + clusterConnector + " Receiving message " + message);
          }
          try
          {

Modified: branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/distribution/MessageRedistributionTest.java
===================================================================
--- branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/distribution/MessageRedistributionTest.java	2011-10-17 19:18:17 UTC (rev 11560)
+++ branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/distribution/MessageRedistributionTest.java	2011-10-18 02:38:12 UTC (rev 11561)
@@ -494,10 +494,11 @@
    {
       for (int i = 0; i < 10; i++)
       {
+         log.info("#test " + i);
          setupCluster(false);
 
          startServers(0, 1, 2);
-
+         
          setupSessionFactory(0, isNetty());
          setupSessionFactory(1, isNetty());
          setupSessionFactory(2, isNetty());

Modified: branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/distribution/TwoWayTwoNodeClusterTest.java
===================================================================
--- branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/distribution/TwoWayTwoNodeClusterTest.java	2011-10-17 19:18:17 UTC (rev 11560)
+++ branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/distribution/TwoWayTwoNodeClusterTest.java	2011-10-18 02:38:12 UTC (rev 11561)
@@ -141,7 +141,6 @@
 
          for (int i = 0; i < 10; i++)
          {
-            Thread.sleep(10);
             log.info("Sleep #test " + i);
             log.info("#stop #test #" + i);
             stopServers(1);



More information about the hornetq-commits mailing list