[jboss-svn-commits] JBL Code SVN: r30940 - labs/jbosstm/workspace/whitingjr/trunk/performance/src/test/java/org/jboss/jbossts/performance.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Tue Jan 5 13:11:10 EST 2010


Author: whitingjr
Date: 2010-01-05 13:11:10 -0500 (Tue, 05 Jan 2010)
New Revision: 30940

Modified:
   labs/jbosstm/workspace/whitingjr/trunk/performance/src/test/java/org/jboss/jbossts/performance/MultiThreadedTest.java
   labs/jbosstm/workspace/whitingjr/trunk/performance/src/test/java/org/jboss/jbossts/performance/WarmedUpTest.java
Log:
Changed to avoid blocking if tests fail.


Modified: labs/jbosstm/workspace/whitingjr/trunk/performance/src/test/java/org/jboss/jbossts/performance/MultiThreadedTest.java
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/performance/src/test/java/org/jboss/jbossts/performance/MultiThreadedTest.java	2010-01-05 18:10:14 UTC (rev 30939)
+++ labs/jbosstm/workspace/whitingjr/trunk/performance/src/test/java/org/jboss/jbossts/performance/MultiThreadedTest.java	2010-01-05 18:11:10 UTC (rev 30940)
@@ -3,8 +3,11 @@
 import java.util.concurrent.CyclicBarrier;
 import java.util.concurrent.Executor;
 
+import org.apache.log4j.Logger;
+
 public abstract class MultiThreadedTest extends MultiResourceTest
 {
+   private static final Logger logger = Logger.getLogger(MultiThreadedTest.class);
    @Override
    public void startConcurrentExecutions(int recurseCount, int threadCount)
          throws Exception
@@ -18,13 +21,20 @@
        * remains active during all demon threads do processing.
        */
       CyclicBarrier completionBarrier = new CyclicBarrier(1 + threadCount);
-      for (int count = 0; count < threadCount; count += 1)
+      for (int count = 1; count <= threadCount; count += 1)
       {
          Executor executor = new ThreadPerTestWorkerExecutor();
-         executor.execute(getTask( recurseCount,  completionBarrier));
+         executor.execute(getTask( recurseCount,  completionBarrier, count));
       }
       completionBarrier.await();// start all the threads processing
-      completionBarrier.await();// all threads fall out of method frame
+      if (!completionBarrier.isBroken())
+      {
+         completionBarrier.await();// all threads fall out of method frame
+      }
+      else
+      {
+         logger.warn("The controlling test class did not await for child threads. The barrier was broken.");
+      }
+      
    }
-
 }

Modified: labs/jbosstm/workspace/whitingjr/trunk/performance/src/test/java/org/jboss/jbossts/performance/WarmedUpTest.java
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/performance/src/test/java/org/jboss/jbossts/performance/WarmedUpTest.java	2010-01-05 18:10:14 UTC (rev 30939)
+++ labs/jbosstm/workspace/whitingjr/trunk/performance/src/test/java/org/jboss/jbossts/performance/WarmedUpTest.java	2010-01-05 18:11:10 UTC (rev 30940)
@@ -86,7 +86,7 @@
     */
    public abstract void startConcurrentExecutions(int recurseCount, int threadCount)  throws Exception;
    
-   public abstract Runnable getTask(int recurseCount, CyclicBarrier completionBarrier ) throws Exception;
+   public abstract Runnable getTask(int recurseCount, CyclicBarrier completionBarrier, int threadId) throws Exception;
    
    public final class ThreadPerTestWorkerExecutor implements Executor
    {
@@ -96,7 +96,7 @@
       public void execute(Runnable command)
       {
          Thread job = new Thread(command);
-         job.run();
+         job.start();
       }
 
       public ThreadPerTestWorkerExecutor()



More information about the jboss-svn-commits mailing list