qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ritch...@apache.org
Subject svn commit: r691260 - /incubator/qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/store/SlowMessageStore.java
Date Tue, 02 Sep 2008 14:26:50 GMT
Author: ritchiem
Date: Tue Sep  2 07:26:50 2008
New Revision: 691260

URL: http://svn.apache.org/viewvc?rev=691260&view=rev
Log:
QPID-1119 : modified the delay method to ensure that it always sleeps for the required time.
Added logging to verify

Modified:
    incubator/qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/store/SlowMessageStore.java

Modified: incubator/qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/store/SlowMessageStore.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/store/SlowMessageStore.java?rev=691260&r1=691259&r2=691260&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/store/SlowMessageStore.java
(original)
+++ incubator/qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/store/SlowMessageStore.java
Tue Sep  2 07:26:50 2008
@@ -48,6 +48,7 @@
 
     public void configure(VirtualHost virtualHost, String base, Configuration config) throws
Exception
     {
+        _logger.info("Starting SlowMessageStore on Virtualhost:" + virtualHost.getName());
         Configuration delays = config.subset(base + "." + DELAYS);
 
         configureDelays(delays);
@@ -119,14 +120,28 @@
     {
         if (delay > 0)
         {
+            long start = System.nanoTime();
             try
             {
+
                 Thread.sleep(delay);
             }
             catch (InterruptedException e)
             {
                 _logger.warn("Interrupted : " + e);
             }
+
+            long slept = (System.nanoTime() - start) / 1000000;
+            
+            if (slept >= delay)
+            {
+                _logger.info("Done sleep for:" + slept+":"+delay);
+            }
+            else
+            {
+                _logger.info("Only sleep for:" + slept + " re-sleeping");
+                doDelay(delay - slept);
+            }
         }
     }
 



Mime
View raw message