activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gtu...@apache.org
Subject svn commit: r1080191 - /activemq/trunk/activemq-spring/src/test/java/org/apache/bugs/LoadBalanceTest.java
Date Thu, 10 Mar 2011 11:39:59 GMT
Author: gtully
Date: Thu Mar 10 11:39:59 2011
New Revision: 1080191

URL: http://svn.apache.org/viewvc?rev=1080191&view=rev
Log:
wait for network bridge formation before starting producer to ensure load is distributed

Modified:
    activemq/trunk/activemq-spring/src/test/java/org/apache/bugs/LoadBalanceTest.java

Modified: activemq/trunk/activemq-spring/src/test/java/org/apache/bugs/LoadBalanceTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-spring/src/test/java/org/apache/bugs/LoadBalanceTest.java?rev=1080191&r1=1080190&r2=1080191&view=diff
==============================================================================
--- activemq/trunk/activemq-spring/src/test/java/org/apache/bugs/LoadBalanceTest.java (original)
+++ activemq/trunk/activemq-spring/src/test/java/org/apache/bugs/LoadBalanceTest.java Thu
Mar 10 11:39:59 2011
@@ -59,6 +59,7 @@ public class LoadBalanceTest {
         final int total = 100;
         final AtomicInteger broker1Count = new AtomicInteger(0);
         final AtomicInteger broker2Count = new AtomicInteger(0);
+        final CountDownLatch startProducer = new CountDownLatch(1);
         try {
             {
                 brokerService1 = new BrokerService();
@@ -137,6 +138,9 @@ public class LoadBalanceTest {
                         });
                         container2.afterPropertiesSet();
                         container2.start();
+
+                        assertTrue("wait for start signal", startProducer.await(20, TimeUnit.SECONDS));
+
                         final CachingConnectionFactory cachingConnectionFactory = new CachingConnectionFactory(
                                 singleConnectionFactory2);
                         final JmsTemplate template = new JmsTemplate(
@@ -173,6 +177,10 @@ public class LoadBalanceTest {
                 }
             });
             pool.shutdown();
+
+            waitForBridgeFormation(10000);
+            startProducer.countDown();
+
             pool.awaitTermination(10, TimeUnit.SECONDS);
             LOG.info("broker1Count " + broker1Count.get() + ", broker2Count " + broker2Count.get());
 



Mime
View raw message