onami-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From as...@apache.org
Subject svn commit: r1462780 - in /incubator/onami/trunk/lifecycle/warmup/src/test/java/org/apachi/onami/lifecycle/warmup: Recorder.java TestWarmUpManager.java
Date Sat, 30 Mar 2013 15:25:07 GMT
Author: ash2k
Date: Sat Mar 30 15:25:07 2013
New Revision: 1462780

URL: http://svn.apache.org/r1462780
Log:
trivial: fix failing test, use Thread.sleep() instead of Object.wait() - better semantics,
no spurious  wake-ups & notifies. No functional changes.

Modified:
    incubator/onami/trunk/lifecycle/warmup/src/test/java/org/apachi/onami/lifecycle/warmup/Recorder.java
    incubator/onami/trunk/lifecycle/warmup/src/test/java/org/apachi/onami/lifecycle/warmup/TestWarmUpManager.java

Modified: incubator/onami/trunk/lifecycle/warmup/src/test/java/org/apachi/onami/lifecycle/warmup/Recorder.java
URL: http://svn.apache.org/viewvc/incubator/onami/trunk/lifecycle/warmup/src/test/java/org/apachi/onami/lifecycle/warmup/Recorder.java?rev=1462780&r1=1462779&r2=1462780&view=diff
==============================================================================
--- incubator/onami/trunk/lifecycle/warmup/src/test/java/org/apachi/onami/lifecycle/warmup/Recorder.java
(original)
+++ incubator/onami/trunk/lifecycle/warmup/src/test/java/org/apachi/onami/lifecycle/warmup/Recorder.java
Sat Mar 30 15:25:07 2013
@@ -52,13 +52,13 @@ public class Recorder
 
         recordings.add( s );
 
-        Long sleepMs = recorderSleepSettings.getSleepMsFor( s );
+        long sleepMs = recorderSleepSettings.getSleepMsFor( s );
 
         activeConcurrents.add( s );
         try
         {
             concurrents.add( new HashSet<String>( activeConcurrents ) );
-            wait( sleepMs );
+            Thread.sleep( sleepMs );
         }
         catch ( InterruptedException e )
         {

Modified: incubator/onami/trunk/lifecycle/warmup/src/test/java/org/apachi/onami/lifecycle/warmup/TestWarmUpManager.java
URL: http://svn.apache.org/viewvc/incubator/onami/trunk/lifecycle/warmup/src/test/java/org/apachi/onami/lifecycle/warmup/TestWarmUpManager.java?rev=1462780&r1=1462779&r2=1462780&view=diff
==============================================================================
--- incubator/onami/trunk/lifecycle/warmup/src/test/java/org/apachi/onami/lifecycle/warmup/TestWarmUpManager.java
(original)
+++ incubator/onami/trunk/lifecycle/warmup/src/test/java/org/apachi/onami/lifecycle/warmup/TestWarmUpManager.java
Sat Mar 30 15:25:07 2013
@@ -242,6 +242,13 @@ public class TestWarmUpManager
             succeeded = false;
             Assert.assertTrue( e.getCause() instanceof TimeoutException );
         }
+
+        // Wait for all interrupted warmup tasks to finish
+        // and add themselfs to recorder.
+        // This fixes race between test thread and interrupted tasks
+        // threads. This workaround is good enough for test.
+        Thread.sleep( 1000 );
+
         Recorder recorder = injector.getInstance( Recorder.class );
 
         System.out.println( recorder.getRecordings() );



Mime
View raw message