You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@manifoldcf.apache.org by kw...@apache.org on 2013/02/07 15:55:20 UTC

svn commit: r1443521 - /manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/jdbcpool/ConnectionPool.java

Author: kwright
Date: Thu Feb  7 14:55:20 2013
New Revision: 1443521

URL: http://svn.apache.org/viewvc?rev=1443521&view=rev
Log:
Expiration of database handles closes connections; if those throw any unusual exceptions, database handles could be lost from the pool.  Part of CONNECTORS-638.

Modified:
    manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/jdbcpool/ConnectionPool.java

Modified: manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/jdbcpool/ConnectionPool.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/jdbcpool/ConnectionPool.java?rev=1443521&r1=1443520&r2=1443521&view=diff
==============================================================================
--- manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/jdbcpool/ConnectionPool.java (original)
+++ manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/jdbcpool/ConnectionPool.java Thu Feb  7 14:55:20 2013
@@ -192,14 +192,8 @@ public class ConnectionPool
     {
       if (connectionCleanupTimeouts[i] <= currentTime)
       {
-        try
-        {
-          freeConnections[i].close();
-        }
-        catch (SQLException e)
-        {
-          Logging.db.warn("Error closing pooled connection: "+e.getMessage(),e);
-        }
+        Connection c = freeConnections[i];
+        freeConnections[i] = null;
         freePointer--;
         if (freePointer == i)
         {
@@ -211,6 +205,15 @@ public class ConnectionPool
           connectionCleanupTimeouts[i] = connectionCleanupTimeouts[freePointer];
           freeConnections[freePointer] = null;
         }
+        try
+        {
+         c.close();
+        }
+        catch (SQLException e)
+        {
+          Logging.db.warn("Error closing pooled connection: "+e.getMessage(),e);
+        }
+        freePointer--;
       }
       else
         i++;