[jboss-svn-commits] JBL Code SVN: r27999 - labs/jbosstm/trunk/ArjunaCore/arjuna/tests/classes/com/hp/mwtests/ts/arjuna/recovery.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Tue Jul 14 08:34:20 EDT 2009


Author: adinn
Date: 2009-07-14 08:34:20 -0400 (Tue, 14 Jul 2009)
New Revision: 27999

Modified:
   labs/jbosstm/trunk/ArjunaCore/arjuna/tests/classes/com/hp/mwtests/ts/arjuna/recovery/CallbackRecoveryTest.java
Log:
removed sleep in place of wait with timeout - fix for JBTM-576

Modified: labs/jbosstm/trunk/ArjunaCore/arjuna/tests/classes/com/hp/mwtests/ts/arjuna/recovery/CallbackRecoveryTest.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/arjuna/tests/classes/com/hp/mwtests/ts/arjuna/recovery/CallbackRecoveryTest.java	2009-07-14 12:08:45 UTC (rev 27998)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/tests/classes/com/hp/mwtests/ts/arjuna/recovery/CallbackRecoveryTest.java	2009-07-14 12:34:20 UTC (rev 27999)
@@ -40,12 +40,26 @@
 
 class RecoveryScanImple implements RecoveryScan
 {
-    public void completed()
+    public synchronized void completed()
     {
         passed = true;
+        notify();
+        notified = true;
     }
 
+    public synchronized void waitForCompleted(int msecs_timeout)
+    {
+        if (!notified) {
+            try {
+                wait(msecs_timeout);
+            } catch (InterruptedException e) {
+                // ignore
+            }
+        }
+    }
+
     public boolean passed = false;
+    private boolean notified = false;
 }
 
 public class CallbackRecoveryTest
@@ -67,18 +81,12 @@
 
         manager.scan(rs);
 
-        // give enough time for both passes to run
-        
-        try
-        {
-            Thread.sleep(2000);
-        }
-        catch (Exception ex)
-        {
-        }
-        
-        System.err.println("**checking");
-        
+        /*
+         * the 30 second wait timeout here is just in case something is not working. the scan should
+         * finish almost straight away
+         */
+        rs.waitForCompleted(30 * 1000);
+
         assertTrue(module.finished());
         assertTrue(rs.passed);
     }




More information about the jboss-svn-commits mailing list