From 091ee37b8e6eae0fca3cdb6f4e9187b9f40469de Mon Sep 17 00:00:00 2001 From: "Timothy A. Bish" Date: Fri, 22 Mar 2013 20:24:43 +0000 Subject: [PATCH] apply patch for: https://issues.apache.org/jira/browse/AMQ-4400 git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1459969 13f79535-47bb-0310-9956-ffa450edef68 --- .../test/java/org/apache/bugs/LoadBalanceTest.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/activemq-spring/src/test/java/org/apache/bugs/LoadBalanceTest.java b/activemq-spring/src/test/java/org/apache/bugs/LoadBalanceTest.java index 99a008794a..0a344c6465 100644 --- a/activemq-spring/src/test/java/org/apache/bugs/LoadBalanceTest.java +++ b/activemq-spring/src/test/java/org/apache/bugs/LoadBalanceTest.java @@ -53,7 +53,7 @@ public class LoadBalanceTest { private static final String TESTING_QUEUE = "testingqueue"; private static int networkBridgePrefetch = 1000; - @Test + @Test(timeout=120000) public void does_load_balance_between_consumers() throws Exception { BrokerService brokerService1 = null; BrokerService brokerService2 = null; @@ -61,13 +61,13 @@ public class LoadBalanceTest { final AtomicInteger broker1Count = new AtomicInteger(0); final AtomicInteger broker2Count = new AtomicInteger(0); final CountDownLatch startProducer = new CountDownLatch(1); + final CountDownLatch consumer1Started = new CountDownLatch(1); + final CountDownLatch consumer2Started = new CountDownLatch(1); String broker1Uri; String broker2Uri; try { - - brokerService1 = new BrokerService(); brokerService1.setBrokerName("one"); brokerService1.setUseJmx(false); @@ -118,6 +118,7 @@ public class LoadBalanceTest { }); container1.afterPropertiesSet(); container1.start(); + consumer1Started.countDown(); pool.submit(new Callable() { @Override @@ -143,6 +144,7 @@ public class LoadBalanceTest { }); container2.afterPropertiesSet(); container2.start(); + consumer2Started.countDown(); assertTrue("wait for start signal", startProducer.await(20, TimeUnit.SECONDS)); @@ -185,9 +187,11 @@ public class LoadBalanceTest { waitForBridgeFormation(); startProducer.countDown(); + consumer1Started.await(); + consumer2Started.await(); pool.shutdown(); - pool.awaitTermination(10, TimeUnit.SECONDS); + pool.awaitTermination(20, TimeUnit.SECONDS); LOG.info("broker1Count " + broker1Count.get() + ", broker2Count " + broker2Count.get()); int count = 0;