commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject commons-dbcp git commit: Fix DBCP-468
Date Wed, 02 Nov 2016 21:43:30 GMT
Repository: commons-dbcp
Updated Branches:
  refs/heads/master 0b5b1be81 -> f740290ca


Fix DBCP-468

Expand the fail-fast for fatal connection errors feature to include
managed connections.

Project: http://git-wip-us.apache.org/repos/asf/commons-dbcp/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-dbcp/commit/f740290c
Tree: http://git-wip-us.apache.org/repos/asf/commons-dbcp/tree/f740290c
Diff: http://git-wip-us.apache.org/repos/asf/commons-dbcp/diff/f740290c

Branch: refs/heads/master
Commit: f740290ca049e11fcb61439469d354a97272dc41
Parents: 0b5b1be
Author: Mark Thomas <markt@apache.org>
Authored: Wed Nov 2 21:40:57 2016 +0000
Committer: Mark Thomas <markt@apache.org>
Committed: Wed Nov 2 21:40:57 2016 +0000

----------------------------------------------------------------------
 src/changes/changes.xml                         |  4 ++++
 .../managed/PoolableManagedConnection.java      | 21 +++++++++++++++++++-
 .../PoolableManagedConnectionFactory.java       |  3 ++-
 3 files changed, 26 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-dbcp/blob/f740290c/src/changes/changes.xml
----------------------------------------------------------------------
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index c03667c..92435a5 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -99,6 +99,10 @@ The <action> type attribute can be add,update,fix,remove.
         Avoid potential infinite loops when checking if an SQLException is fatal
         for a connection or not.
       </action>
+      <action dev="markt" type="fix" issue="DBCP-468">
+        Expand the fail-fast for fatal connection errors feature to include
+        managed connections.
+      </action>
     </release>
     <release version="2.1.1" date="6 Aug 2015" description=
 "This is a patch release, including bug fixes only.">

http://git-wip-us.apache.org/repos/asf/commons-dbcp/blob/f740290c/src/main/java/org/apache/commons/dbcp2/managed/PoolableManagedConnection.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/dbcp2/managed/PoolableManagedConnection.java
b/src/main/java/org/apache/commons/dbcp2/managed/PoolableManagedConnection.java
index 23498e7..8e09b0b 100644
--- a/src/main/java/org/apache/commons/dbcp2/managed/PoolableManagedConnection.java
+++ b/src/main/java/org/apache/commons/dbcp2/managed/PoolableManagedConnection.java
@@ -19,6 +19,7 @@ package org.apache.commons.dbcp2.managed;
 
 import java.sql.Connection;
 import java.sql.SQLException;
+import java.util.Collection;
 
 import org.apache.commons.dbcp2.PoolableConnection;
 import org.apache.commons.pool2.ObjectPool;
@@ -43,7 +44,25 @@ public class PoolableManagedConnection extends PoolableConnection {
      */
     public PoolableManagedConnection(final TransactionRegistry transactionRegistry,
             final Connection conn, final ObjectPool<PoolableConnection> pool) {
-        super(conn, pool, null);
+        this(transactionRegistry, conn, pool, null, false);
+    }
+
+
+    /**
+     * Create a PoolableManagedConnection.
+     *
+     * @param transactionRegistry transaction registry
+     * @param conn underlying connection
+     * @param pool connection pool
+     * @param disconnectSqlCodes SQL_STATE codes considered fatal disconnection errors
+     * @param fastFailValidation true means fatal disconnection errors cause subsequent
+     *        validations to fail immediately (no attempt to run query or isValid)
+     */
+    public PoolableManagedConnection(final TransactionRegistry transactionRegistry,
+            final Connection conn, final ObjectPool<PoolableConnection> pool,
+            final Collection<String> disconnectSqlCodes,
+            final boolean fastFailValidation) {
+        super(conn, pool, null, disconnectSqlCodes, fastFailValidation);
         this.transactionRegistry = transactionRegistry;
     }
 

http://git-wip-us.apache.org/repos/asf/commons-dbcp/blob/f740290c/src/main/java/org/apache/commons/dbcp2/managed/PoolableManagedConnectionFactory.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/dbcp2/managed/PoolableManagedConnectionFactory.java
b/src/main/java/org/apache/commons/dbcp2/managed/PoolableManagedConnectionFactory.java
index c01d26f..99304dd 100644
--- a/src/main/java/org/apache/commons/dbcp2/managed/PoolableManagedConnectionFactory.java
+++ b/src/main/java/org/apache/commons/dbcp2/managed/PoolableManagedConnectionFactory.java
@@ -93,7 +93,8 @@ public class PoolableManagedConnectionFactory extends PoolableConnectionFactory
             ((PoolingConnection) conn).setCacheState(getCacheState());
         }
         final PoolableManagedConnection pmc =
-                new PoolableManagedConnection(transactionRegistry, conn, getPool());
+                new PoolableManagedConnection(transactionRegistry, conn, getPool(),
+                        getDisconnectionSqlCodes(), isFastFailValidation());
         pmc.setCacheState(getCacheState());
         return new DefaultPooledObject<PoolableConnection>(pmc);
     }


Mime
View raw message