From 6d4b219fff1b458d6aa0160fb180f3cb3fa942fe Mon Sep 17 00:00:00 2001 From: fhanik Date: Thu, 4 Mar 2010 17:21:41 +0000 Subject: [PATCH] Add in and document more XA support git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@919076 13f79535-47bb-0310-9956-ffa450edef68 --- modules/jdbc-pool/build.properties.default | 4 ++-- modules/jdbc-pool/doc/jdbc-pool.xml | 5 +++-- .../java/org/apache/tomcat/jdbc/pool/PoolProperties.java | 1 + .../java/org/apache/tomcat/jdbc/pool/ProxyConnection.java | 8 +++++++- 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/modules/jdbc-pool/build.properties.default b/modules/jdbc-pool/build.properties.default index b439ee6eb..dcd05067d 100644 --- a/modules/jdbc-pool/build.properties.default +++ b/modules/jdbc-pool/build.properties.default @@ -27,8 +27,8 @@ # ----- Vesion Control Flags ----- version.major=1 version.minor=0 -version.build=8 -version.patch=5 +version.build=9 +version.patch=0 version.suffix= # ----- Default Base Path for Dependent Packages ----- diff --git a/modules/jdbc-pool/doc/jdbc-pool.xml b/modules/jdbc-pool/doc/jdbc-pool.xml index 2a4448b75..acbd41bb2 100644 --- a/modules/jdbc-pool/doc/jdbc-pool.xml +++ b/modules/jdbc-pool/doc/jdbc-pool.xml @@ -88,7 +88,7 @@
  • Get JMX notifications and log entries when connections are suspected for being abandoned. This is similar to the removeAbandonedTimeout but it doesn't take any action, only reports the information. This is achieved using the suspectTimeout attribute.
  • -
  • Connections can be retrieved from a java.sql.Driver or a javax.sql.DataSource +
  • Connections can be retrieved from a java.sql.Driver, javax.sql.DataSource or javax.sql.XADataSource This is achieved using the dataSource and dataSourceJNDI attributes.
  • XA connection support
  • @@ -149,7 +149,8 @@

    factory is required, and the value should be org.apache.tomcat.jdbc.pool.DataSourceFactory

    -

    Type should always be javax.sql.DataSource

    +

    Type should always be javax.sql.DataSource or javax.sql.XADataSource

    +

    Depending on the type a org.apache.tomcat.jdbc.pool.DataSource or a org.apache.tomcat.jdbc.pool.XADataSource will be created.

    diff --git a/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/PoolProperties.java b/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/PoolProperties.java index e9a070e47..7c5cb1fa9 100644 --- a/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/PoolProperties.java +++ b/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/PoolProperties.java @@ -749,6 +749,7 @@ public class PoolProperties implements PoolConfiguration { boolean result = timer && (isRemoveAbandoned() && getRemoveAbandonedTimeout()>0); result = result || (timer && getSuspectTimeout()>0); result = result || (timer && isTestWhileIdle() && getValidationQuery()!=null); + result = result || (timer && getMinEvictableIdleTimeMillis()>0); return result; } diff --git a/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/ProxyConnection.java b/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/ProxyConnection.java index cb0edd49c..532cb6a24 100644 --- a/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/ProxyConnection.java +++ b/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/ProxyConnection.java @@ -68,13 +68,19 @@ public class ProxyConnection extends JdbcInterceptor { } public boolean isWrapperFor(Class iface) throws SQLException { - return (iface.isInstance(connection.getConnection())); + if (iface == XAConnection.class && connection.getXAConnection()!=null) { + return true; + } else { + return (iface.isInstance(connection.getConnection())); + } } public Object unwrap(Class iface) throws SQLException { if (iface == PooledConnection.class) { return connection; + }else if (iface == XAConnection.class) { + return connection.getXAConnection(); } else if (isWrapperFor(iface)) { return connection.getConnection(); } else { -- 2.11.0