diff options
| author | Martin Ritchie <ritchiem@apache.org> | 2010-01-19 19:26:30 +0000 |
|---|---|---|
| committer | Martin Ritchie <ritchiem@apache.org> | 2010-01-19 19:26:30 +0000 |
| commit | ddd558a8eeb31a597068572d546c80d24a3a491f (patch) | |
| tree | c9bfa860657ab0da97cf283d29309a7a209c0b55 /qpid/java | |
| parent | 94f0f507eef4cdcf3422403350ef294a07ce85bd (diff) | |
| download | qpid-python-ddd558a8eeb31a597068572d546c80d24a3a491f.tar.gz | |
QPID-1825 : Updated test to only start the 'clock' for timeout when the message count on the queue hasn't changed after a 100ms sleep.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@900919 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java')
| -rw-r--r-- | qpid/java/systests/src/main/java/org/apache/qpid/server/queue/TimeToLiveTest.java | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/server/queue/TimeToLiveTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/server/queue/TimeToLiveTest.java index 428368f859..c73959676d 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/server/queue/TimeToLiveTest.java +++ b/qpid/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); |
