NO-JIRA Fix AnycastTest.testTxCommitReceive random failure
This commit is contained in:
parent
87cc15700f
commit
c395db526c
|
@ -94,11 +94,20 @@ public class AnycastTest extends ActiveMQTestBase {
|
||||||
}
|
}
|
||||||
assertNull(consumer1.receive(200));
|
assertNull(consumer1.receive(200));
|
||||||
assertNull(consumer2.receive(200));
|
assertNull(consumer2.receive(200));
|
||||||
|
|
||||||
|
// before commit close the consumers because it can trigger delivering count
|
||||||
|
// that makes getMessageCount temporarily inaccurate.
|
||||||
|
consumer1.close();
|
||||||
|
consumer2.close();
|
||||||
|
|
||||||
session.commit();
|
session.commit();
|
||||||
|
|
||||||
assertTrue(TimeUtils.waitOnBoolean(true, 2000, () -> num / 2 == q1.getMessageCount()));
|
assertTrue(TimeUtils.waitOnBoolean(true, 2000, () -> num / 2 == q1.getMessageCount()));
|
||||||
assertTrue(TimeUtils.waitOnBoolean(true, 2000, () -> num / 2 == q2.getMessageCount()));
|
assertTrue(TimeUtils.waitOnBoolean(true, 2000, () -> num / 2 == q2.getMessageCount()));
|
||||||
|
|
||||||
|
consumer1 = session.createConsumer(q1.getName());
|
||||||
|
consumer2 = session.createConsumer(q2.getName());
|
||||||
|
|
||||||
ClientConsumer[] consumers = new ClientConsumer[]{consumer1, consumer2};
|
ClientConsumer[] consumers = new ClientConsumer[]{consumer1, consumer2};
|
||||||
for (int i = 0; i < consumers.length; i++) {
|
for (int i = 0; i < consumers.length; i++) {
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue