correct counter behavior.
authorfhanik <fhanik@13f79535-47bb-0310-9956-ffa450edef68>
Fri, 10 Jul 2009 16:42:00 +0000 (16:42 +0000)
committerfhanik <fhanik@13f79535-47bb-0310-9956-ffa450edef68>
Fri, 10 Jul 2009 16:42:00 +0000 (16:42 +0000)
git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@793029 13f79535-47bb-0310-9956-ffa450edef68

modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java

index a8ea1c5..c2c69f5 100644 (file)
@@ -532,10 +532,11 @@ public class ConnectionPool {
             if (size.get() < getPoolProperties().getMaxActive()) {
                 //atomic duplicate check
                 if (size.addAndGet(1) > getPoolProperties().getMaxActive()) {
-                    return createConnection(now, con);
-                } else {
                     //if we got here, two threads passed through the first if
                     size.decrementAndGet();
+                } else {
+                    //create a connection, we're below the limit
+                    return createConnection(now, con);
                 }
             } //end if