tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fha...@apache.org
Subject svn commit: r708753 - /tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/FairBlockingQueue.java
Date Wed, 29 Oct 2008 02:15:35 GMT
Author: fhanik
Date: Tue Oct 28 19:15:35 2008
New Revision: 708753

URL: http://svn.apache.org/viewvc?rev=708753&view=rev
Log:
Fix the performance issue, don't count down until the lock has been released, this allows
for much more concurrency

Modified:
    tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/FairBlockingQueue.java

Modified: tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/FairBlockingQueue.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/FairBlockingQueue.java?rev=708753&r1=708752&r2=708753&view=diff
==============================================================================
--- tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/FairBlockingQueue.java
(original)
+++ tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/FairBlockingQueue.java
Tue Oct 28 19:15:35 2008
@@ -50,17 +50,18 @@
     public boolean offer(E e) {
         final ReentrantLock lock = this.lock;
         lock.lock();
+        ExchangeCountDownLatch<E> c = null;
         try {
             if (waiters.size() > 0) {
-                ExchangeCountDownLatch<E> c = waiters.poll();
+                c = waiters.poll();
                 c.setItem(e);
-                c.countDown();
             } else {
                 items.add(e);
             }
         } finally {
             lock.unlock();
         }
+        if (c!=null) c.countDown();
         return true;
     }
 



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message