[jboss-cvs] JBossAS SVN: r57458 - trunk/testsuite/src/main/org/jboss/test/cluster/test

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Oct 5 18:59:15 EDT 2006


Author: bstansberry at jboss.com
Date: 2006-10-05 18:59:15 -0400 (Thu, 05 Oct 2006)
New Revision: 57458

Modified:
   trunk/testsuite/src/main/org/jboss/test/cluster/test/DRMTestCase.java
Log:
Ensure the deployers get the semaphore

Modified: trunk/testsuite/src/main/org/jboss/test/cluster/test/DRMTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/test/DRMTestCase.java	2006-10-05 22:57:33 UTC (rev 57457)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/test/DRMTestCase.java	2006-10-05 22:59:15 UTC (rev 57458)
@@ -1015,12 +1015,28 @@
          // Launch the threads
          semaphore.release(count + 1);
          
-         // Give the threads time to acquire the semaphore
-         sleepThread(100);
-         
          boolean reacquired = false;
          try
          {
+            // Give the threads 5 secs to acquire the semaphore
+            long maxElapsed = System.currentTimeMillis() + 5000;
+            for (int i = 0; i < keys.length; i++)
+            {
+               if (deployers[i].getCount() < 0)
+               {
+                  assertTrue("Thread " + keys[i] + " started in time",
+                              maxElapsed - System.currentTimeMillis() > 0);
+                  sleepThread(10);
+                  i--; // try again
+               }   
+            }
+            
+            while (jgThread.getCount() < 0)
+            {
+               assertTrue("jgThread started in time",
+                           maxElapsed - System.currentTimeMillis() > 0);
+               sleepThread(10);               
+            }
             // Reaquire all the permits, thus showing the threads didn't deadlock
             
             // Give them 500 ms per loop




More information about the jboss-cvs-commits mailing list