[hornetq-commits] JBoss hornetq SVN: r11208 - in branches/Branch_2_2_EAP: tests/src/org/hornetq/tests/integration/cluster/distribution and 1 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Sun Aug 14 21:49:22 EDT 2011


Author: clebert.suconic at jboss.com
Date: 2011-08-14 21:49:22 -0400 (Sun, 14 Aug 2011)
New Revision: 11208

Modified:
   branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java
   branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java
   branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/failover/GroupingFailoverTestBase.java
Log:
test fixes

Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java
===================================================================
--- branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java	2011-08-14 16:24:54 UTC (rev 11207)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java	2011-08-15 01:49:22 UTC (rev 11208)
@@ -358,6 +358,7 @@
                //looks like we've failed over at some point need to inform that we are the backup so when the current live
                // goes down they failover to us
                clusterManager.announceBackup();
+               Thread.sleep(configuration.getFailbackDelay());
             }
 
             nodeManager.startLiveNode();

Modified: branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java
===================================================================
--- branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java	2011-08-14 16:24:54 UTC (rev 11207)
+++ branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java	2011-08-15 01:49:22 UTC (rev 11208)
@@ -100,6 +100,8 @@
       consumers = new ConsumerHolder[ClusterTestBase.MAX_CONSUMERS];
 
       servers = new HornetQServer[ClusterTestBase.MAX_SERVERS];
+      
+      timeStarts = new long[ClusterTestBase.MAX_SERVERS];
 
       sfs = new ClientSessionFactory[ClusterTestBase.MAX_SERVERS];
 
@@ -182,6 +184,8 @@
    protected ConsumerHolder[] consumers;
 
    protected HornetQServer[] servers;
+   
+   protected long[] timeStarts;
 
    protected NodeManager[] nodeManagers;
 
@@ -2017,6 +2021,12 @@
       for (int node : nodes)
       {
          log.info("#test start node " + node);
+         if (System.currentTimeMillis() - timeStarts[node] < 1000)
+         {
+            Thread.sleep(1000);
+         }
+         timeStarts[node] = System.currentTimeMillis();
+         
          servers[node].setIdentity("server " + node);
          ClusterTestBase.log.info("starting server " + servers[node]);
          servers[node].start();
@@ -2027,11 +2037,6 @@
 
          waitForServer(servers[node]);
 
-         /*
-          * we need to wait a little while between server start up to allow the server to communicate in some order.
-          * This is to avoid split brain on startup
-          * */
-         Thread.sleep(500);
       }
 
    }
@@ -2077,9 +2082,15 @@
          {
             try
             {
+               if (System.currentTimeMillis() - timeStarts[node] < 1000)
+               {
+                  // We can't stop and start a node too fast (faster than what the Topology could realize about this
+                  Thread.sleep(1000);
+               }
+               timeStarts[node] = System.currentTimeMillis();
+               
                ClusterTestBase.log.info("stopping server " + node);
                servers[node].stop();
-               Thread.sleep(500);
                ClusterTestBase.log.info("server " + node + " stopped");
             }
             catch (Exception e)

Modified: branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/failover/GroupingFailoverTestBase.java
===================================================================
--- branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/failover/GroupingFailoverTestBase.java	2011-08-14 16:24:54 UTC (rev 11207)
+++ branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/failover/GroupingFailoverTestBase.java	2011-08-15 01:49:22 UTC (rev 11208)
@@ -166,6 +166,7 @@
 
          closeSessionFactory(0);
 
+         Thread.sleep(1000);
          servers[0].stop(true);
 
          waitForServerRestart(2);



More information about the hornetq-commits mailing list