[jboss-cvs] JBossAS SVN: r109297 - projects/jboss-jca/branches/performance/pojos/src/main/java/org/jboss/jca/performance/pojos.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Nov 12 09:27:36 EST 2010


Author: jesper.pedersen
Date: 2010-11-12 09:27:35 -0500 (Fri, 12 Nov 2010)
New Revision: 109297

Modified:
   projects/jboss-jca/branches/performance/pojos/src/main/java/org/jboss/jca/performance/pojos/DatabaseTester.java
Log:
Use a LinkedBlockingQueue instead

Modified: projects/jboss-jca/branches/performance/pojos/src/main/java/org/jboss/jca/performance/pojos/DatabaseTester.java
===================================================================
--- projects/jboss-jca/branches/performance/pojos/src/main/java/org/jboss/jca/performance/pojos/DatabaseTester.java	2010-11-12 12:28:55 UTC (rev 109296)
+++ projects/jboss-jca/branches/performance/pojos/src/main/java/org/jboss/jca/performance/pojos/DatabaseTester.java	2010-11-12 14:27:35 UTC (rev 109297)
@@ -29,9 +29,10 @@
 import java.util.List;
 import java.util.concurrent.BlockingQueue;
 import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.SynchronousQueue;
+import java.util.concurrent.LinkedBlockingQueue;
 import java.util.concurrent.ThreadPoolExecutor;
 import java.util.concurrent.TimeUnit;
+import java.util.logging.Level;
 import java.util.logging.Logger;
 
 import javax.naming.Context;
@@ -141,8 +142,8 @@
          {
             CountDownLatch cdl = new CountDownLatch(iterations);
 
-            BlockingQueue<Runnable> threadPoolQueue = new SynchronousQueue<Runnable>(true);
-            ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(Runtime.getRuntime().availableProcessors(), maxThreads,
+            BlockingQueue<Runnable> threadPoolQueue = new LinkedBlockingQueue<Runnable>(iterations);
+            ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(maxThreads, maxThreads,
                                                                            60, TimeUnit.SECONDS,
                                                                            threadPoolQueue);
 
@@ -178,6 +179,9 @@
 
       long elapsed = end - start;
 
+      if (elapsed < 0)
+         elapsed = 1;
+
       log.info("Took: " + elapsed + " ms");
       log.info("Unit of work/ms: " + (iterations / (double)elapsed));
    }
@@ -277,7 +281,7 @@
                // Ignore
             }
 
-            log.severe(t.getMessage());
+            log.log(Level.SEVERE, t.getMessage(), t);
          }
          finally
          {



More information about the jboss-cvs-commits mailing list