Improving a test that failed due to what seemed a race
This commit is contained in:
parent
519a47f023
commit
2f819a63e7
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue