Add in and document more XA support
authorfhanik <fhanik@13f79535-47bb-0310-9956-ffa450edef68>
Thu, 4 Mar 2010 17:21:41 +0000 (17:21 +0000)
committerfhanik <fhanik@13f79535-47bb-0310-9956-ffa450edef68>
Thu, 4 Mar 2010 17:21:41 +0000 (17:21 +0000)
git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@919076 13f79535-47bb-0310-9956-ffa450edef68

modules/jdbc-pool/build.properties.default
modules/jdbc-pool/doc/jdbc-pool.xml
modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/PoolProperties.java
modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/ProxyConnection.java

index b439ee6..dcd0506 100644 (file)
@@ -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 -----
index 2a4448b..acbd41b 100644 (file)
@@ -88,7 +88,7 @@
       <li>Get JMX notifications and log entries when connections are suspected for being abandoned. This is similar to
           the <code>removeAbandonedTimeout</code> but it doesn't take any action, only reports the information. 
           This is achieved using the <code>suspectTimeout</code> attribute.</li> 
-      <li>Connections can be retrieved from a <code>java.sql.Driver</code> or a <code>javax.sql.DataSource</code>
+      <li>Connections can be retrieved from a <code>java.sql.Driver</code>, <code>javax.sql.DataSource</code> or <code>javax.sql.XADataSource</code> 
           This is achieved using the <code>dataSource</code> and <code>dataSourceJNDI</code> attributes.</li>
       <li>XA connection support</li>
     </ol>
         <p>factory is required, and the value should be <code>org.apache.tomcat.jdbc.pool.DataSourceFactory</code></p>
       </attribute>
       <attribute name="type" required="true">
-        <p>Type should always be <code>javax.sql.DataSource</code></p>
+        <p>Type should always be <code>javax.sql.DataSource</code> or <code>javax.sql.XADataSource</code></p>
+        <p>Depending on the type a <code>org.apache.tomcat.jdbc.pool.DataSource</code> or a <code>org.apache.tomcat.jdbc.pool.XADataSource</code> will be created.</p>
       </attribute>
     </attributes>
   </subsection>
index e9a070e..7c5cb1f 100644 (file)
@@ -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;
     }
     
index cb0edd4..532cb6a 100644 (file)
@@ -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 {