Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=49831
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Wed, 8 Sep 2010 15:27:00 +0000 (15:27 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Wed, 8 Sep 2010 15:27:00 +0000 (15:27 +0000)
Make sure pooled XA connections are properly closed when the pool shuts down.
Based on a patch by Daniel Mikusa.

git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@995091 13f79535-47bb-0310-9956-ffa450edef68

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

index 14ac8ef..69f7997 100644 (file)
@@ -265,7 +265,11 @@ public class PooledConnection {
         if (connection != null) {
             try {
                 parent.disconnectEvent(this, finalize);
-                connection.close();
+                if (xaConnection == null) {
+                    connection.close();
+                } else {
+                    xaConnection.close();
+                }
             }catch (Exception ignore) {
                 if (log.isDebugEnabled()) {
                     log.debug("Unable to close underlying SQL connection",ignore);