Author: ritchiem
Date: Tue Jan 19 19:26:30 2010
New Revision: 900919
URL: http://svn.apache.org/viewvc?rev=900919&view=rev
Log:
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.
Modified:
qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/queue/TimeToLiveTest.java
Modified:
qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/queue/TimeToLiveTest.java
URL:
http://svn.apache.org/viewvc/qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/queue/TimeToLiveTest.java?rev=900919&r1=900918&r2=900919&view=diff
==============================================================================
---
qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/queue/TimeToLiveTest.java
(original)
+++
qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/queue/TimeToLiveTest.java
Tue Jan 19 19:26:30 2010
@@ -177,15 +177,26 @@
{
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);
---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project: http://qpid.apache.org
Use/Interact: mailto:[email protected]