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

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Fri Jan 29 09:18:21 EST 2010


Author: whitingjr
Date: 2010-01-29 09:18:21 -0500 (Fri, 29 Jan 2010)
New Revision: 31303

Modified:
   labs/jbosstm/workspace/whitingjr/trunk/performance/src/test/java/org/jboss/jbossts/performance/jdbc/JDBCTest.java
Log:
Added implementation.

Modified: labs/jbosstm/workspace/whitingjr/trunk/performance/src/test/java/org/jboss/jbossts/performance/jdbc/JDBCTest.java
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/performance/src/test/java/org/jboss/jbossts/performance/jdbc/JDBCTest.java	2010-01-29 14:17:43 UTC (rev 31302)
+++ labs/jbosstm/workspace/whitingjr/trunk/performance/src/test/java/org/jboss/jbossts/performance/jdbc/JDBCTest.java	2010-01-29 14:18:21 UTC (rev 31303)
@@ -32,6 +32,7 @@
 import org.apache.log4j.NDC;
 import org.jboss.jbossts.performance.MultiThreadedTest;
 import org.jboss.jbossts.performance.resource.SynchronizeTask;
+import org.testng.Assert;
 
 public class JDBCTest extends MultiThreadedTest
 {
@@ -85,9 +86,66 @@
       @Override
       public void run()
       {
-         // FIXME run
+         try
+         {/* use the barrier to wait for all concurrent threads, when finished decrement the latch and fall out of 
+         method. Means the profiler does not 
+         */
+            NDC.inherit(this.parentNDC);
+            NDC.push(this.threadId.toString());
+            this.completionBarrier.await();// await all threads ready to start
+            recurse(this.recurseCount);
+            logger.info("Finished recursing. Awaiting on synch point.");
+
+            if (!this.completionBarrier.isBroken())
+            {// fall out of thread without waiting.
+               this.completionBarrier.await();// await all threads have finished
+            }
+         }
+         catch (Exception e)
+         {
+            logger.error(e.getMessage(), e);
+            this.completionBarrier.reset();
+            Assert.fail(e.getMessage());
+         }
+         catch (AssertionError ae)
+         {
+            this.completionBarrier.reset();
+            throw ae;
+         }
+         finally
+         {
+            NDC.clear();
+         }
+      }
+      
+      /**
+       * Run the test sequentially.
+       * 
+       * @param count
+       */
+      private void recurse(final int count)
+      {
+         for (int i = 0; i < count; i += 1)
+         {
+            try
+            {
+               task();
+               logger.debug("Completed profiled run of testbody for thread ["+this.threadId.toString()+"] count ["+i+"].");
+               
+            } catch (Exception e)
+            {
+               this.completionBarrier.reset();
+               logger.error("Failed profiled run of testbody for thread ["+this.threadId.toString()+"] count ["+i+"].");
+               Assert.fail(e.getMessage(), e);
+            }
+         }
+      }
+      public void task()
+      throws Exception
+      {
          
       }
+   
       
    }
 }



More information about the jboss-svn-commits mailing list