summaryrefslogtreecommitdiff
path: root/java/systests/src
diff options
context:
space:
mode:
Diffstat (limited to 'java/systests/src')
-rw-r--r--java/systests/src/main/java/org/apache/qpid/server/queue/TimeToLiveTest.java17
1 files changed, 14 insertions, 3 deletions
diff --git a/java/systests/src/main/java/org/apache/qpid/server/queue/TimeToLiveTest.java b/java/systests/src/main/java/org/apache/qpid/server/queue/TimeToLiveTest.java
index 428368f859..c73959676d 100644
--- a/java/systests/src/main/java/org/apache/qpid/server/queue/TimeToLiveTest.java
+++ b/java/systests/src/main/java/org/apache/qpid/server/queue/TimeToLiveTest.java
@@ -177,15 +177,26 @@ public class TimeToLiveTest extends QpidTestCase
{
producer.send(producerSession.createTextMessage("Message: "+i));
}
- long failureTime = System.currentTimeMillis() + 2*SERVER_TTL_TIMEOUT;
+ long failureTime = System.currentTimeMillis() + 2 * SERVER_TTL_TIMEOUT;
- // check Queue depth for up to TIMEOUT seconds
- long messageCount;
+ // check Queue depth for up to TIMEOUT seconds after the Queue Depth hasn't changed for 100ms.
+ long messageCount = MSG_COUNT;
+ long lastPass;
do
{
+ lastPass = messageCount;
Thread.sleep(100);
messageCount = producerSession.getQueueDepth((AMQDestination) queue);
+
+ // If we have received messages in the last loop then extend the timeout time.
+ // if we get messages stuck that are not expiring then the failureTime will occur
+ // failing the test. This will help with the scenario when the broker does not
+ // have enough CPU cycles to process the TTLs.
+ if (lastPass != messageCount)
+ {
+ failureTime = System.currentTimeMillis() + 2 * SERVER_TTL_TIMEOUT;
+ }
}
while(messageCount > 0L && System.currentTimeMillis() < failureTime);