You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ri...@apache.org on 2010/01/19 20:39:39 UTC

svn commit: r900925 - in /qpid/branches/0.5.x-dev/qpid/java: ./ systests/src/main/java/org/apache/qpid/server/queue/TimeToLiveTest.java

Author: ritchiem
Date: Tue Jan 19 19:39:39 2010
New Revision: 900925

URL: http://svn.apache.org/viewvc?rev=900925&view=rev
Log:
QPID-1825 : Updated test to check if queue count has changed and only then start timing. Merged r900919 from trunk

Modified:
    qpid/branches/0.5.x-dev/qpid/java/   (props changed)
    qpid/branches/0.5.x-dev/qpid/java/systests/src/main/java/org/apache/qpid/server/queue/TimeToLiveTest.java

Propchange: qpid/branches/0.5.x-dev/qpid/java/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Jan 19 19:39:39 2010
@@ -1,2 +1,2 @@
 /qpid/branches/java-broker-0-10/qpid/java:829414,829575
-/qpid/trunk/qpid/java:835115,884634-884635,884838,885765,887948,887950-887952,887994,888246,888248,888250,888345,888348,889645,891323-891332,892228,896674,896692-896693
+/qpid/trunk/qpid/java:835115,884634-884635,884838,885765,887948,887950-887952,887994,888246,888248,888250,888345,888348,889645,891323-891332,892228,896674,896692-896693,900919

Modified: qpid/branches/0.5.x-dev/qpid/java/systests/src/main/java/org/apache/qpid/server/queue/TimeToLiveTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/0.5.x-dev/qpid/java/systests/src/main/java/org/apache/qpid/server/queue/TimeToLiveTest.java?rev=900925&r1=900924&r2=900925&view=diff
==============================================================================
--- qpid/branches/0.5.x-dev/qpid/java/systests/src/main/java/org/apache/qpid/server/queue/TimeToLiveTest.java (original)
+++ qpid/branches/0.5.x-dev/qpid/java/systests/src/main/java/org/apache/qpid/server/queue/TimeToLiveTest.java Tue Jan 19 19:39:39 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:commits-subscribe@qpid.apache.org