From 2f819a63e7afa734d096156277358933c3311c45 Mon Sep 17 00:00:00 2001 From: Clebert Suconic Date: Mon, 16 Mar 2015 19:17:52 -0400 Subject: [PATCH] Improving a test that failed due to what seemed a race --- .../tests/unit/core/server/impl/QueueImplTest.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/tests/unit/core/server/impl/QueueImplTest.java b/tests/unit-tests/src/test/java/org/apache/activemq/tests/unit/core/server/impl/QueueImplTest.java index 8286ab665e..3be1f611ad 100644 --- a/tests/unit-tests/src/test/java/org/apache/activemq/tests/unit/core/server/impl/QueueImplTest.java +++ b/tests/unit-tests/src/test/java/org/apache/activemq/tests/unit/core/server/impl/QueueImplTest.java @@ -625,8 +625,13 @@ public class QueueImplTest extends UnitTestCase queue.resume(); // Need to make sure the consumers will receive the messages before we do these assertions - long timeout = System.currentTimeMillis() + 1000; - while (cons1.getReferences().size() != numMessages / 2 && cons2.getReferences().size() != numMessages / 2 && timeout > System.currentTimeMillis()) + long timeout = System.currentTimeMillis() + 5000; + while (cons1.getReferences().size() != numMessages / 2 && timeout > System.currentTimeMillis()) + { + Thread.sleep(1); + } + + while (cons2.getReferences().size() != numMessages / 2 && timeout > System.currentTimeMillis()) { Thread.sleep(1); }