You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2010/09/15 15:24:15 UTC

svn commit: r997321 - /tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java

Author: markt
Date: Wed Sep 15 13:24:14 2010
New Revision: 997321

URL: http://svn.apache.org/viewvc?rev=997321&view=rev
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=49584
Move the offering of a new thread on release from the abandoned connection code to the release code to eliminate the possibility of a blocked thread on release.

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

Modified: tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java?rev=997321&r1=997320&r2=997321&view=diff
==============================================================================
--- tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java (original)
+++ tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java Wed Sep 15 13:24:14 2010
@@ -466,9 +466,6 @@ public class ConnectionPool {
             }
             //release the connection
             release(con);
-            //we've asynchronously reduced the number of connections
-            //we could have threads stuck in idle.poll(timeout) that will never be notified
-            if (waitcount.get()>0) idle.offer(new PooledConnection(poolProperties,this));
         } finally {
             con.unlock();
         }
@@ -517,6 +514,12 @@ public class ConnectionPool {
         } finally {
             con.unlock();
         }
+        // we've asynchronously reduced the number of connections
+        // we could have threads stuck in idle.poll(timeout) that will never be
+        // notified
+        if (waitcount.get() > 0) {
+            idle.offer(new PooledConnection(poolProperties, this));
+        }
     }
 
     /**



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