This is an automated email from the ASF dual-hosted git repository.
clebertsuconic pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/activemq-artemis.git
The following commit(s) were added to refs/heads/master by this push:
new 70e3888 NO-JIRA Fix QueueImplTest#testRoundRobinWithQueueing
new 64944e0 This closes #2585
70e3888 is described below
commit 70e3888910b9ba38a35a3964f0d3e11384d94060
Author: Howard Gao <[email protected]>
AuthorDate: Fri Mar 15 12:05:23 2019 +0800
NO-JIRA Fix QueueImplTest#testRoundRobinWithQueueing
This test fails occasionally because the queue's delivering thread
may interference with the consumer's iterator during consumers adding.
The result is that the first of the 2 consumers may get iterated
twice and therefore the messages received by the 2 consumers are
not even.
Tha change puts the message add after the consumer add so that
the delivering thread only kicks off after consumers are all added
and messages should be evenly distributed to both consumers.
---
.../tests/unit/core/server/impl/QueueImplTest.java | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git
a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/server/impl/QueueImplTest.java
b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/server/impl/QueueImplTest.java
index 90e0ae1..f20cce3 100644
---
a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/server/impl/QueueImplTest.java
+++
b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/server/impl/QueueImplTest.java
@@ -584,14 +584,6 @@ public class QueueImplTest extends ActiveMQTestBase {
// Test first with queueing
- for (int i = 0; i < numMessages; i++) {
- MessageReference ref = generateReference(queue, i);
-
- refs.add(ref);
-
- queue.addTail(ref);
- }
-
FakeConsumer cons1 = new FakeConsumer();
FakeConsumer cons2 = new FakeConsumer();
@@ -600,6 +592,14 @@ public class QueueImplTest extends ActiveMQTestBase {
queue.addConsumer(cons2);
+ for (int i = 0; i < numMessages; i++) {
+ MessageReference ref = generateReference(queue, i);
+
+ refs.add(ref);
+
+ queue.addTail(ref);
+ }
+
queue.resume();
// Need to make sure the consumers will receive the messages before we
do these assertions