cshannon commented on code in PR #1628:
URL: https://github.com/apache/activemq/pull/1628#discussion_r2719143379
##########
activemq-unit-tests/src/test/java/org/apache/activemq/JMSConsumerTest.java:
##########
@@ -1019,15 +1016,22 @@ public void testAckOfExpired() throws Exception {
Session sendSession = connection.createSession(false,
Session.AUTO_ACKNOWLEDGE);
MessageProducer producer = sendSession.createProducer(destination);
- producer.setTimeToLive(500);
+ final int ttl = 500;
+ producer.setTimeToLive(ttl);
final int count = 4;
for (int i = 0; i < count; i++) {
TextMessage message = sendSession.createTextMessage("" + i);
producer.send(message);
}
// let first bunch in queue expire
- Thread.sleep(1000);
+ final long expiryTime = System.currentTimeMillis() +
TimeUnit.MILLISECONDS.toMillis(ttl * 2L);
+ assertTrue("ttl elapsed", Wait.waitFor(new Wait.Condition() {
Review Comment:
I'm not sure I see the point of using the Wat.waitFor() here. Isn't this
just doing the same thing as if you called Thread.sleep(expiryTime)?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information, visit: https://activemq.apache.org/contact