Modified: 
tomcat/tc8.0.x/trunk/java/org/apache/tomcat/dbcp/dbcp2/datasources/InstanceKeyDataSource.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc8.0.x/trunk/java/org/apache/tomcat/dbcp/dbcp2/datasources/InstanceKeyDataSource.java?rev=1833816&r1=1833815&r2=1833816&view=diff
==============================================================================
--- 
tomcat/tc8.0.x/trunk/java/org/apache/tomcat/dbcp/dbcp2/datasources/InstanceKeyDataSource.java
 (original)
+++ 
tomcat/tc8.0.x/trunk/java/org/apache/tomcat/dbcp/dbcp2/datasources/InstanceKeyDataSource.java
 Tue Jun 19 11:21:13 2018
@@ -39,132 +39,104 @@ import org.apache.tomcat.dbcp.pool2.impl
 import org.apache.tomcat.dbcp.pool2.impl.GenericKeyedObjectPoolConfig;
 
 /**
- * <p>The base class for <code>SharedPoolDataSource</code> and
- * <code>PerUserPoolDataSource</code>.  Many of the configuration properties
- * are shared and defined here.  This class is declared public in order
- * to allow particular usage with commons-beanutils; do not make direct
- * use of it outside of <em>commons-dbcp2</em>.
+ * <p>
+ * The base class for <code>SharedPoolDataSource</code> and 
<code>PerUserPoolDataSource</code>. Many of the
+ * configuration properties are shared and defined here. This class is 
declared public in order to allow particular
+ * usage with commons-beanutils; do not make direct use of it outside of 
<em>commons-dbcp2</em>.
  * </p>
  *
  * <p>
- * A J2EE container will normally provide some method of initializing the
- * <code>DataSource</code> whose attributes are presented
- * as bean getters/setters and then deploying it via JNDI.  It is then
- * available to an application as a source of pooled logical connections to
- * the database.  The pool needs a source of physical connections.  This
- * source is in the form of a <code>ConnectionPoolDataSource</code> that
- * can be specified via the {@link #setDataSourceName(String)} used to
- * lookup the source via JNDI.
+ * A J2EE container will normally provide some method of initializing the 
<code>DataSource</code> whose attributes are
+ * presented as bean getters/setters and then deploying it via JNDI. It is 
then available to an application as a source
+ * of pooled logical connections to the database. The pool needs a source of 
physical connections. This source is in the
+ * form of a <code>ConnectionPoolDataSource</code> that can be specified via 
the {@link #setDataSourceName(String)} used
+ * to lookup the source via JNDI.
  * </p>
  *
  * <p>
- * Although normally used within a JNDI environment, A DataSource
- * can be instantiated and initialized as any bean.  In this case the
- * <code>ConnectionPoolDataSource</code> will likely be instantiated in
- * a similar manner.  This class allows the physical source of connections
- * to be attached directly to this pool using the
+ * Although normally used within a JNDI environment, A DataSource can be 
instantiated and initialized as any bean. In
+ * this case the <code>ConnectionPoolDataSource</code> will likely be 
instantiated in a similar manner. This class
+ * allows the physical source of connections to be attached directly to this 
pool using the
  * {@link #setConnectionPoolDataSource(ConnectionPoolDataSource)} method.
  * </p>
  *
  * <p>
- * The dbcp package contains an adapter,
- * {@link org.apache.tomcat.dbcp.dbcp2.cpdsadapter.DriverAdapterCPDS},
- * that can be used to allow the use of <code>DataSource</code>'s based on this
- * class with JDBC driver implementations that do not supply a
- * <code>ConnectionPoolDataSource</code>, but still
- * provide a {@link java.sql.Driver} implementation.
+ * The dbcp package contains an adapter, {@link 
org.apache.tomcat.dbcp.dbcp2.cpdsadapter.DriverAdapterCPDS}, that can be
+ * used to allow the use of <code>DataSource</code>'s based on this class with 
JDBC driver implementations that do not
+ * supply a <code>ConnectionPoolDataSource</code>, but still provide a {@link 
java.sql.Driver} implementation.
  * </p>
  *
  * <p>
- * The <a href="package-summary.html">package documentation</a> contains an
- * example using Apache Tomcat and JNDI and it also contains a non-JNDI 
example.
+ * The <a href="package-summary.html">package documentation</a> contains an 
example using Apache Tomcat and JNDI and it
+ * also contains a non-JNDI example.
  * </p>
  *
- * @author John D. McNally
  * @since 2.0
  */
-public abstract class InstanceKeyDataSource
-        implements DataSource, Referenceable, Serializable, AutoCloseable {
+public abstract class InstanceKeyDataSource implements DataSource, 
Referenceable, Serializable, AutoCloseable {
 
     private static final long serialVersionUID = -6819270431752240878L;
 
-    private static final String GET_CONNECTION_CALLED
-            = "A Connection was already requested from this source, "
+    private static final String GET_CONNECTION_CALLED = "A Connection was 
already requested from this source, "
             + "further initialization is not allowed.";
-    private static final String BAD_TRANSACTION_ISOLATION
-        = "The requested TransactionIsolation level is invalid.";
+    private static final String BAD_TRANSACTION_ISOLATION = "The requested 
TransactionIsolation level is invalid.";
 
     /**
-    * Internal constant to indicate the level is not set.
-    */
+     * Internal constant to indicate the level is not set.
+     */
     protected static final int UNKNOWN_TRANSACTIONISOLATION = -1;
 
     /** Guards property setters - once true, setters throw 
IllegalStateException */
-    private volatile boolean getConnectionCalled = false;
+    private volatile boolean getConnectionCalled;
 
     /** Underlying source of PooledConnections */
-    private ConnectionPoolDataSource dataSource = null;
+    private ConnectionPoolDataSource dataSource;
 
     /** DataSource Name used to find the ConnectionPoolDataSource */
-    private String dataSourceName = null;
+    private String dataSourceName;
 
     /** Description */
-    private String description = null;
+    private String description;
 
     /** Environment that may be used to set up a jndi initial context. */
-    private Properties jndiEnvironment = null;
+    private Properties jndiEnvironment;
 
     /** Login TimeOut in seconds */
-    private int loginTimeout = 0;
+    private int loginTimeout;
 
     /** Log stream */
-    private PrintWriter logWriter = null;
+    private PrintWriter logWriter;
 
     /** Instance key */
-    private String instanceKey = null;
+    private String instanceKey;
 
     // Pool properties
-    private boolean defaultBlockWhenExhausted =
-            BaseObjectPoolConfig.DEFAULT_BLOCK_WHEN_EXHAUSTED;
-    private String defaultEvictionPolicyClassName =
-            BaseObjectPoolConfig.DEFAULT_EVICTION_POLICY_CLASS_NAME;
+    private boolean defaultBlockWhenExhausted = 
BaseObjectPoolConfig.DEFAULT_BLOCK_WHEN_EXHAUSTED;
+    private String defaultEvictionPolicyClassName = 
BaseObjectPoolConfig.DEFAULT_EVICTION_POLICY_CLASS_NAME;
     private boolean defaultLifo = BaseObjectPoolConfig.DEFAULT_LIFO;
-    private int defaultMaxIdle =
-            GenericKeyedObjectPoolConfig.DEFAULT_MAX_IDLE_PER_KEY;
-    private int defaultMaxTotal =
-            GenericKeyedObjectPoolConfig.DEFAULT_MAX_TOTAL;
-    private long defaultMaxWaitMillis =
-            BaseObjectPoolConfig.DEFAULT_MAX_WAIT_MILLIS;
-    private long defaultMinEvictableIdleTimeMillis =
-            BaseObjectPoolConfig.DEFAULT_MIN_EVICTABLE_IDLE_TIME_MILLIS;
-    private int defaultMinIdle =
-            GenericKeyedObjectPoolConfig.DEFAULT_MIN_IDLE_PER_KEY;
-    private int defaultNumTestsPerEvictionRun =
-            BaseObjectPoolConfig.DEFAULT_NUM_TESTS_PER_EVICTION_RUN;
-    private long defaultSoftMinEvictableIdleTimeMillis =
-            BaseObjectPoolConfig.DEFAULT_SOFT_MIN_EVICTABLE_IDLE_TIME_MILLIS;
-    private boolean defaultTestOnCreate =
-            BaseObjectPoolConfig.DEFAULT_TEST_ON_CREATE;
-    private boolean defaultTestOnBorrow =
-            BaseObjectPoolConfig.DEFAULT_TEST_ON_BORROW;
-    private boolean defaultTestOnReturn =
-            BaseObjectPoolConfig.DEFAULT_TEST_ON_RETURN;
-    private boolean defaultTestWhileIdle =
-            BaseObjectPoolConfig.DEFAULT_TEST_WHILE_IDLE;
-    private long defaultTimeBetweenEvictionRunsMillis =
-            BaseObjectPoolConfig.DEFAULT_TIME_BETWEEN_EVICTION_RUNS_MILLIS;
+    private int defaultMaxIdle = 
GenericKeyedObjectPoolConfig.DEFAULT_MAX_IDLE_PER_KEY;
+    private int defaultMaxTotal = 
GenericKeyedObjectPoolConfig.DEFAULT_MAX_TOTAL;
+    private long defaultMaxWaitMillis = 
BaseObjectPoolConfig.DEFAULT_MAX_WAIT_MILLIS;
+    private long defaultMinEvictableIdleTimeMillis = 
BaseObjectPoolConfig.DEFAULT_MIN_EVICTABLE_IDLE_TIME_MILLIS;
+    private int defaultMinIdle = 
GenericKeyedObjectPoolConfig.DEFAULT_MIN_IDLE_PER_KEY;
+    private int defaultNumTestsPerEvictionRun = 
BaseObjectPoolConfig.DEFAULT_NUM_TESTS_PER_EVICTION_RUN;
+    private long defaultSoftMinEvictableIdleTimeMillis = 
BaseObjectPoolConfig.DEFAULT_SOFT_MIN_EVICTABLE_IDLE_TIME_MILLIS;
+    private boolean defaultTestOnCreate = 
BaseObjectPoolConfig.DEFAULT_TEST_ON_CREATE;
+    private boolean defaultTestOnBorrow = 
BaseObjectPoolConfig.DEFAULT_TEST_ON_BORROW;
+    private boolean defaultTestOnReturn = 
BaseObjectPoolConfig.DEFAULT_TEST_ON_RETURN;
+    private boolean defaultTestWhileIdle = 
BaseObjectPoolConfig.DEFAULT_TEST_WHILE_IDLE;
+    private long defaultTimeBetweenEvictionRunsMillis = 
BaseObjectPoolConfig.DEFAULT_TIME_BETWEEN_EVICTION_RUNS_MILLIS;
 
     // Connection factory properties
-    private String validationQuery = null;
-    private int validationQueryTimeout = -1;
-    private boolean rollbackAfterValidation = false;
+    private String validationQuery;
+    private int validationQueryTimeoutSeconds = -1;
+    private boolean rollbackAfterValidation;
     private long maxConnLifetimeMillis = -1;
 
     // Connection properties
-    private Boolean defaultAutoCommit = null;
+    private Boolean defaultAutoCommit;
     private int defaultTransactionIsolation = UNKNOWN_TRANSACTIONISOLATION;
-    private Boolean defaultReadOnly = null;
-
+    private Boolean defaultReadOnly;
 
     /**
      * Default no-arg constructor for Serialization
@@ -173,18 +145,16 @@ public abstract class InstanceKeyDataSou
     }
 
     /**
-     * Throws an IllegalStateException, if a PooledConnection has already
-     * been requested.
+     * Throws an IllegalStateException, if a PooledConnection has already been 
requested.
      */
-    protected void assertInitializationAllowed()
-        throws IllegalStateException {
+    protected void assertInitializationAllowed() throws IllegalStateException {
         if (getConnectionCalled) {
             throw new IllegalStateException(GET_CONNECTION_CALLED);
         }
     }
 
     /**
-     * Close the connection pool being maintained by this datasource.
+     * Closes the connection pool being maintained by this datasource.
      */
     @Override
     public abstract void close() throws Exception;
@@ -208,23 +178,25 @@ public abstract class InstanceKeyDataSou
         throw new SQLFeatureNotSupportedException();
     }
 
-
     // -------------------------------------------------------------------
     // Properties
 
     /**
-     * Gets the default value for
-     * {@link GenericKeyedObjectPoolConfig#getBlockWhenExhausted()} for each 
per
-     * user pool.
+     * Gets the default value for {@link 
GenericKeyedObjectPoolConfig#getBlockWhenExhausted()} for each per user pool.
+     *
+     * @return The default value for {@link 
GenericKeyedObjectPoolConfig#getBlockWhenExhausted()} for each per user
+     *         pool.
      */
     public boolean getDefaultBlockWhenExhausted() {
         return this.defaultBlockWhenExhausted;
     }
 
     /**
-     * Sets the default value for
-     * {@link GenericKeyedObjectPoolConfig#getBlockWhenExhausted()} for each 
per
-     * user pool.
+     * Sets the default value for {@link 
GenericKeyedObjectPoolConfig#getBlockWhenExhausted()} for each per user pool.
+     *
+     * @param blockWhenExhausted
+     *            The default value for {@link 
GenericKeyedObjectPoolConfig#getBlockWhenExhausted()} for each per user
+     *            pool.
      */
     public void setDefaultBlockWhenExhausted(final boolean blockWhenExhausted) 
{
         assertInitializationAllowed();
@@ -232,36 +204,43 @@ public abstract class InstanceKeyDataSou
     }
 
     /**
-     * Gets the default value for
-     * {@link GenericKeyedObjectPoolConfig#getEvictionPolicyClassName()} for
-     * each per user pool.
+     * Gets the default value for {@link 
GenericKeyedObjectPoolConfig#getEvictionPolicyClassName()} for each per user
+     * pool.
+     *
+     * @return The default value for {@link 
GenericKeyedObjectPoolConfig#getEvictionPolicyClassName()} for each per user
+     *         pool.
      */
     public String getDefaultEvictionPolicyClassName() {
         return this.defaultEvictionPolicyClassName;
     }
 
     /**
-     * Sets the default value for
-     * {@link GenericKeyedObjectPoolConfig#getEvictionPolicyClassName()} for
-     * each per user pool.
+     * Sets the default value for {@link 
GenericKeyedObjectPoolConfig#getEvictionPolicyClassName()} for each per user
+     * pool.
+     *
+     * @param evictionPolicyClassName
+     *            The default value for {@link 
GenericKeyedObjectPoolConfig#getEvictionPolicyClassName()} for each per
+     *            user pool.
      */
-    public void setDefaultEvictionPolicyClassName(
-            final String evictionPolicyClassName) {
+    public void setDefaultEvictionPolicyClassName(final String 
evictionPolicyClassName) {
         assertInitializationAllowed();
         this.defaultEvictionPolicyClassName = evictionPolicyClassName;
     }
 
     /**
-     * Gets the default value for
-     * {@link GenericKeyedObjectPoolConfig#getLifo()} for each per user pool.
+     * Gets the default value for {@link 
GenericKeyedObjectPoolConfig#getLifo()} for each per user pool.
+     *
+     * @return The default value for {@link 
GenericKeyedObjectPoolConfig#getLifo()} for each per user pool.
      */
     public boolean getDefaultLifo() {
         return this.defaultLifo;
     }
 
     /**
-     * Sets the default value for
-     * {@link GenericKeyedObjectPoolConfig#getLifo()} for each per user pool.
+     * Sets the default value for {@link 
GenericKeyedObjectPoolConfig#getLifo()} for each per user pool.
+     *
+     * @param lifo
+     *            The default value for {@link 
GenericKeyedObjectPoolConfig#getLifo()} for each per user pool.
      */
     public void setDefaultLifo(final boolean lifo) {
         assertInitializationAllowed();
@@ -269,18 +248,19 @@ public abstract class InstanceKeyDataSou
     }
 
     /**
-     * Gets the default value for
-     * {@link GenericKeyedObjectPoolConfig#getMaxIdlePerKey()} for each per 
user
-     * pool.
+     * Gets the default value for {@link 
GenericKeyedObjectPoolConfig#getMaxIdlePerKey()} for each per user pool.
+     *
+     * @return The default value for {@link 
GenericKeyedObjectPoolConfig#getMaxIdlePerKey()} for each per user pool.
      */
     public int getDefaultMaxIdle() {
         return this.defaultMaxIdle;
     }
 
     /**
-     * Sets the default value for
-     * {@link GenericKeyedObjectPoolConfig#getMaxIdlePerKey()} for each per 
user
-     * pool.
+     * Sets the default value for {@link 
GenericKeyedObjectPoolConfig#getMaxIdlePerKey()} for each per user pool.
+     *
+     * @param maxIdle
+     *            The default value for {@link 
GenericKeyedObjectPoolConfig#getMaxIdlePerKey()} for each per user pool.
      */
     public void setDefaultMaxIdle(final int maxIdle) {
         assertInitializationAllowed();
@@ -288,18 +268,19 @@ public abstract class InstanceKeyDataSou
     }
 
     /**
-     * Gets the default value for
-     * {@link GenericKeyedObjectPoolConfig#getMaxTotalPerKey()} for each per
-     * user pool.
+     * Gets the default value for {@link 
GenericKeyedObjectPoolConfig#getMaxTotalPerKey()} for each per user pool.
+     *
+     * @return The default value for {@link 
GenericKeyedObjectPoolConfig#getMaxTotalPerKey()} for each per user pool.
      */
     public int getDefaultMaxTotal() {
         return this.defaultMaxTotal;
     }
 
     /**
-     * Sets the default value for
-     * {@link GenericKeyedObjectPoolConfig#getMaxTotalPerKey()} for each per
-     * user pool.
+     * Sets the default value for {@link 
GenericKeyedObjectPoolConfig#getMaxTotalPerKey()} for each per user pool.
+     *
+     * @param maxTotal
+     *            The default value for {@link 
GenericKeyedObjectPoolConfig#getMaxTotalPerKey()} for each per user pool.
      */
     public void setDefaultMaxTotal(final int maxTotal) {
         assertInitializationAllowed();
@@ -307,18 +288,19 @@ public abstract class InstanceKeyDataSou
     }
 
     /**
-     * Gets the default value for
-     * {@link GenericKeyedObjectPoolConfig#getMaxWaitMillis()} for each per 
user
-     * pool.
+     * Gets the default value for {@link 
GenericKeyedObjectPoolConfig#getMaxWaitMillis()} for each per user pool.
+     *
+     * @return The default value for {@link 
GenericKeyedObjectPoolConfig#getMaxWaitMillis()} for each per user pool.
      */
     public long getDefaultMaxWaitMillis() {
         return this.defaultMaxWaitMillis;
     }
 
     /**
-     * Sets the default value for
-     * {@link GenericKeyedObjectPoolConfig#getMaxWaitMillis()} for each per 
user
-     * pool.
+     * Sets the default value for {@link 
GenericKeyedObjectPoolConfig#getMaxWaitMillis()} for each per user pool.
+     *
+     * @param maxWaitMillis
+     *            The default value for {@link 
GenericKeyedObjectPoolConfig#getMaxWaitMillis()} for each per user pool.
      */
     public void setDefaultMaxWaitMillis(final long maxWaitMillis) {
         assertInitializationAllowed();
@@ -326,38 +308,43 @@ public abstract class InstanceKeyDataSou
     }
 
     /**
-     * Gets the default value for
-     * {@link GenericKeyedObjectPoolConfig#getMinEvictableIdleTimeMillis()} for
-     * each per user pool.
+     * Gets the default value for {@link 
GenericKeyedObjectPoolConfig#getMinEvictableIdleTimeMillis()} for each per user
+     * pool.
+     *
+     * @return The default value for {@link 
GenericKeyedObjectPoolConfig#getMinEvictableIdleTimeMillis()} for each per
+     *         user pool.
      */
     public long getDefaultMinEvictableIdleTimeMillis() {
         return this.defaultMinEvictableIdleTimeMillis;
     }
 
     /**
-     * Sets the default value for
-     * {@link GenericKeyedObjectPoolConfig#getMinEvictableIdleTimeMillis()} for
-     * each per user pool.
+     * Sets the default value for {@link 
GenericKeyedObjectPoolConfig#getMinEvictableIdleTimeMillis()} for each per user
+     * pool.
+     *
+     * @param minEvictableIdleTimeMillis
+     *            The default value for {@link 
GenericKeyedObjectPoolConfig#getMinEvictableIdleTimeMillis()} for each
+     *            per user pool.
      */
-    public void setDefaultMinEvictableIdleTimeMillis(
-            final long minEvictableIdleTimeMillis) {
+    public void setDefaultMinEvictableIdleTimeMillis(final long 
minEvictableIdleTimeMillis) {
         assertInitializationAllowed();
         this.defaultMinEvictableIdleTimeMillis = minEvictableIdleTimeMillis;
     }
 
     /**
-     * Gets the default value for
-     * {@link GenericKeyedObjectPoolConfig#getMinIdlePerKey()} for each per 
user
-     * pool.
+     * Gets the default value for {@link 
GenericKeyedObjectPoolConfig#getMinIdlePerKey()} for each per user pool.
+     *
+     * @return The default value for {@link 
GenericKeyedObjectPoolConfig#getMinIdlePerKey()} for each per user pool.
      */
     public int getDefaultMinIdle() {
         return this.defaultMinIdle;
     }
 
     /**
-     * Sets the default value for
-     * {@link GenericKeyedObjectPoolConfig#getMinIdlePerKey()} for each per 
user
-     * pool.
+     * Sets the default value for {@link 
GenericKeyedObjectPoolConfig#getMinIdlePerKey()} for each per user pool.
+     *
+     * @param minIdle
+     *            The default value for {@link 
GenericKeyedObjectPoolConfig#getMinIdlePerKey()} for each per user pool.
      */
     public void setDefaultMinIdle(final int minIdle) {
         assertInitializationAllowed();
@@ -365,18 +352,23 @@ public abstract class InstanceKeyDataSou
     }
 
     /**
-     * Gets the default value for
-     * {@link GenericKeyedObjectPoolConfig#getNumTestsPerEvictionRun()} for 
each
-     * per user pool.
+     * Gets the default value for {@link 
GenericKeyedObjectPoolConfig#getNumTestsPerEvictionRun()} for each per user
+     * pool.
+     *
+     * @return The default value for {@link 
GenericKeyedObjectPoolConfig#getNumTestsPerEvictionRun()} for each per user
+     *         pool.
      */
     public int getDefaultNumTestsPerEvictionRun() {
         return this.defaultNumTestsPerEvictionRun;
     }
 
     /**
-     * Sets the default value for
-     * {@link GenericKeyedObjectPoolConfig#getNumTestsPerEvictionRun()} for 
each
-     * per user pool.
+     * Sets the default value for {@link 
GenericKeyedObjectPoolConfig#getNumTestsPerEvictionRun()} for each per user
+     * pool.
+     *
+     * @param numTestsPerEvictionRun
+     *            The default value for {@link 
GenericKeyedObjectPoolConfig#getNumTestsPerEvictionRun()} for each per
+     *            user pool.
      */
     public void setDefaultNumTestsPerEvictionRun(final int 
numTestsPerEvictionRun) {
         assertInitializationAllowed();
@@ -384,35 +376,47 @@ public abstract class InstanceKeyDataSou
     }
 
     /**
-     * Gets the default value for
-     * {@link org.apache.tomcat.dbcp.pool2.impl.GenericObjectPool 
GenericObjectPool#getSoftMinEvictableIdleTimeMillis()} for each
-     * per user pool.
+     * Gets the default value for {@link 
org.apache.tomcat.dbcp.pool2.impl.GenericObjectPool
+     * GenericObjectPool#getSoftMinEvictableIdleTimeMillis()} for each per 
user pool.
+     *
+     * @return The default value for {@link 
org.apache.tomcat.dbcp.pool2.impl.GenericObjectPool
+     *         GenericObjectPool#getSoftMinEvictableIdleTimeMillis()} for each 
per user pool.
      */
     public long getDefaultSoftMinEvictableIdleTimeMillis() {
         return this.defaultSoftMinEvictableIdleTimeMillis;
     }
 
     /**
-     * Sets the default value for
-     * {@link org.apache.tomcat.dbcp.pool2.impl.GenericObjectPool 
GenericObjectPool#getSoftMinEvictableIdleTimeMillis()} for each per user pool.
+     * Sets the default value for {@link 
org.apache.tomcat.dbcp.pool2.impl.GenericObjectPool
+     * GenericObjectPool#getSoftMinEvictableIdleTimeMillis()} for each per 
user pool.
+     *
+     * @param softMinEvictableIdleTimeMillis
+     *            The default value for {@link 
org.apache.tomcat.dbcp.pool2.impl.GenericObjectPool
+     *            GenericObjectPool#getSoftMinEvictableIdleTimeMillis()} for 
each per user pool.
      */
-    public void setDefaultSoftMinEvictableIdleTimeMillis(
-            final long softMinEvictableIdleTimeMillis) {
+    public void setDefaultSoftMinEvictableIdleTimeMillis(final long 
softMinEvictableIdleTimeMillis) {
         assertInitializationAllowed();
         this.defaultSoftMinEvictableIdleTimeMillis = 
softMinEvictableIdleTimeMillis;
     }
 
     /**
-     * Gets the default value for
-     * {@link org.apache.tomcat.dbcp.pool2.impl.GenericObjectPool 
GenericObjectPool#getTestOnCreate()} for each per user pool.
+     * Gets the default value for {@link 
org.apache.tomcat.dbcp.pool2.impl.GenericObjectPool
+     * GenericObjectPool#getTestOnCreate()} for each per user pool.
+     *
+     * @return The default value for {@link 
org.apache.tomcat.dbcp.pool2.impl.GenericObjectPool
+     *         GenericObjectPool#getTestOnCreate()} for each per user pool.
      */
     public boolean getDefaultTestOnCreate() {
         return this.defaultTestOnCreate;
     }
 
     /**
-     * Sets the default value for
-     * {@link org.apache.tomcat.dbcp.pool2.impl.GenericObjectPool 
GenericObjectPool#getTestOnCreate()} for each per user pool.
+     * Sets the default value for {@link 
org.apache.tomcat.dbcp.pool2.impl.GenericObjectPool
+     * GenericObjectPool#getTestOnCreate()} for each per user pool.
+     *
+     * @param testOnCreate
+     *            The default value for {@link 
org.apache.tomcat.dbcp.pool2.impl.GenericObjectPool
+     *            GenericObjectPool#getTestOnCreate()} for each per user pool.
      */
     public void setDefaultTestOnCreate(final boolean testOnCreate) {
         assertInitializationAllowed();
@@ -420,16 +424,23 @@ public abstract class InstanceKeyDataSou
     }
 
     /**
-     * Gets the default value for
-     * {@link org.apache.tomcat.dbcp.pool2.impl.GenericObjectPool 
GenericObjectPool#getTestOnBorrow()} for each per user pool.
+     * Gets the default value for {@link 
org.apache.tomcat.dbcp.pool2.impl.GenericObjectPool
+     * GenericObjectPool#getTestOnBorrow()} for each per user pool.
+     *
+     * @return The default value for {@link 
org.apache.tomcat.dbcp.pool2.impl.GenericObjectPool
+     *         GenericObjectPool#getTestOnBorrow()} for each per user pool.
      */
     public boolean getDefaultTestOnBorrow() {
         return this.defaultTestOnBorrow;
     }
 
     /**
-     * Sets the default value for
-     * {@link org.apache.tomcat.dbcp.pool2.impl.GenericObjectPool 
GenericObjectPool#getTestOnBorrow()} for each per user pool.
+     * Sets the default value for {@link 
org.apache.tomcat.dbcp.pool2.impl.GenericObjectPool
+     * GenericObjectPool#getTestOnBorrow()} for each per user pool.
+     *
+     * @param testOnBorrow
+     *            The default value for {@link 
org.apache.tomcat.dbcp.pool2.impl.GenericObjectPool
+     *            GenericObjectPool#getTestOnBorrow()} for each per user pool.
      */
     public void setDefaultTestOnBorrow(final boolean testOnBorrow) {
         assertInitializationAllowed();
@@ -437,16 +448,23 @@ public abstract class InstanceKeyDataSou
     }
 
     /**
-     * Gets the default value for
-     * {@link org.apache.tomcat.dbcp.pool2.impl.GenericObjectPool 
GenericObjectPool#getTestOnReturn()} for each per user pool.
+     * Gets the default value for {@link 
org.apache.tomcat.dbcp.pool2.impl.GenericObjectPool
+     * GenericObjectPool#getTestOnReturn()} for each per user pool.
+     *
+     * @return The default value for {@link 
org.apache.tomcat.dbcp.pool2.impl.GenericObjectPool
+     *         GenericObjectPool#getTestOnReturn()} for each per user pool.
      */
     public boolean getDefaultTestOnReturn() {
         return this.defaultTestOnReturn;
     }
 
     /**
-     * Sets the default value for
-     * {@link org.apache.tomcat.dbcp.pool2.impl.GenericObjectPool 
GenericObjectPool#getTestOnReturn()} for each per user pool.
+     * Sets the default value for {@link 
org.apache.tomcat.dbcp.pool2.impl.GenericObjectPool
+     * GenericObjectPool#getTestOnReturn()} for each per user pool.
+     *
+     * @param testOnReturn
+     *            The default value for {@link 
org.apache.tomcat.dbcp.pool2.impl.GenericObjectPool
+     *            GenericObjectPool#getTestOnReturn()} for each per user pool.
      */
     public void setDefaultTestOnReturn(final boolean testOnReturn) {
         assertInitializationAllowed();
@@ -454,16 +472,23 @@ public abstract class InstanceKeyDataSou
     }
 
     /**
-     * Gets the default value for
-     * {@link org.apache.tomcat.dbcp.pool2.impl.GenericObjectPool 
GenericObjectPool#getTestWhileIdle()} for each per user pool.
+     * Gets the default value for {@link 
org.apache.tomcat.dbcp.pool2.impl.GenericObjectPool
+     * GenericObjectPool#getTestWhileIdle()} for each per user pool.
+     *
+     * @return The default value for {@link 
org.apache.tomcat.dbcp.pool2.impl.GenericObjectPool
+     *         GenericObjectPool#getTestWhileIdle()} for each per user pool.
      */
     public boolean getDefaultTestWhileIdle() {
         return this.defaultTestWhileIdle;
     }
 
     /**
-     * Sets the default value for
-     * {@link org.apache.tomcat.dbcp.pool2.impl.GenericObjectPool 
GenericObjectPool#getTestWhileIdle()} for each per user pool.
+     * Sets the default value for {@link 
org.apache.tomcat.dbcp.pool2.impl.GenericObjectPool
+     * GenericObjectPool#getTestWhileIdle()} for each per user pool.
+     *
+     * @param testWhileIdle
+     *            The default value for {@link 
org.apache.tomcat.dbcp.pool2.impl.GenericObjectPool
+     *            GenericObjectPool#getTestWhileIdle()} for each per user pool.
      */
     public void setDefaultTestWhileIdle(final boolean testWhileIdle) {
         assertInitializationAllowed();
@@ -471,28 +496,32 @@ public abstract class InstanceKeyDataSou
     }
 
     /**
-     * Gets the default value for
-     * {@link org.apache.tomcat.dbcp.pool2.impl.GenericObjectPool 
GenericObjectPool#getTimeBetweenEvictionRunsMillis ()} for each
-     * per user pool.
+     * Gets the default value for {@link 
org.apache.tomcat.dbcp.pool2.impl.GenericObjectPool
+     * GenericObjectPool#getTimeBetweenEvictionRunsMillis ()} for each per 
user pool.
+     *
+     * @return The default value for {@link 
org.apache.tomcat.dbcp.pool2.impl.GenericObjectPool
+     *         GenericObjectPool#getTimeBetweenEvictionRunsMillis ()} for each 
per user pool.
      */
-    public long getDefaultTimeBetweenEvictionRunsMillis () {
-        return this.defaultTimeBetweenEvictionRunsMillis ;
+    public long getDefaultTimeBetweenEvictionRunsMillis() {
+        return this.defaultTimeBetweenEvictionRunsMillis;
     }
 
     /**
-     * Sets the default value for
-     * {@link org.apache.tomcat.dbcp.pool2.impl.GenericObjectPool 
GenericObjectPool#getTimeBetweenEvictionRunsMillis ()} for each
-     * per user pool.
+     * Sets the default value for {@link 
org.apache.tomcat.dbcp.pool2.impl.GenericObjectPool
+     * GenericObjectPool#getTimeBetweenEvictionRunsMillis ()} for each per 
user pool.
+     *
+     * @param timeBetweenEvictionRunsMillis
+     *            The default value for {@link 
org.apache.tomcat.dbcp.pool2.impl.GenericObjectPool
+     *            GenericObjectPool#getTimeBetweenEvictionRunsMillis ()} for 
each per user pool.
      */
-    public void setDefaultTimeBetweenEvictionRunsMillis (
-            final long timeBetweenEvictionRunsMillis ) {
+    public void setDefaultTimeBetweenEvictionRunsMillis(final long 
timeBetweenEvictionRunsMillis) {
         assertInitializationAllowed();
-        this.defaultTimeBetweenEvictionRunsMillis = 
timeBetweenEvictionRunsMillis ;
+        this.defaultTimeBetweenEvictionRunsMillis = 
timeBetweenEvictionRunsMillis;
     }
 
     /**
-     * Get the value of connectionPoolDataSource.  This method will return
-     * null, if the backing datasource is being accessed via jndi.
+     * Gets the value of connectionPoolDataSource. This method will return 
null, if the backing datasource is being
+     * accessed via jndi.
      *
      * @return value of connectionPoolDataSource.
      */
@@ -501,30 +530,27 @@ public abstract class InstanceKeyDataSou
     }
 
     /**
-     * Set the backend ConnectionPoolDataSource.  This property should not be
-     * set if using jndi to access the datasource.
+     * Sets the backend ConnectionPoolDataSource. This property should not be 
set if using jndi to access the
+     * datasource.
      *
-     * @param v  Value to assign to connectionPoolDataSource.
+     * @param v
+     *            Value to assign to connectionPoolDataSource.
      */
     public void setConnectionPoolDataSource(final ConnectionPoolDataSource v) {
         assertInitializationAllowed();
         if (dataSourceName != null) {
-            throw new IllegalStateException(
-                "Cannot set the DataSource, if JNDI is used.");
+            throw new IllegalStateException("Cannot set the DataSource, if 
JNDI is used.");
         }
-        if (dataSource != null)
-        {
-            throw new IllegalStateException(
-                "The CPDS has already been set. It cannot be altered.");
+        if (dataSource != null) {
+            throw new IllegalStateException("The CPDS has already been set. It 
cannot be altered.");
         }
         dataSource = v;
         instanceKey = InstanceKeyDataSourceFactory.registerNewInstance(this);
     }
 
     /**
-     * Get the name of the ConnectionPoolDataSource which backs this pool.
-     * This name is used to look up the datasource from a jndi service
-     * provider.
+     * Gets the name of the ConnectionPoolDataSource which backs this pool. 
This name is used to look up the datasource
+     * from a jndi service provider.
      *
      * @return value of dataSourceName.
      */
@@ -533,35 +559,29 @@ public abstract class InstanceKeyDataSou
     }
 
     /**
-     * Set the name of the ConnectionPoolDataSource which backs this pool.
-     * This name is used to look up the datasource from a jndi service
-     * provider.
+     * Sets the name of the ConnectionPoolDataSource which backs this pool. 
This name is used to look up the datasource
+     * from a jndi service provider.
      *
-     * @param v  Value to assign to dataSourceName.
+     * @param v
+     *            Value to assign to dataSourceName.
      */
     public void setDataSourceName(final String v) {
         assertInitializationAllowed();
         if (dataSource != null) {
-            throw new IllegalStateException(
-                "Cannot set the JNDI name for the DataSource, if already " +
-                "set using setConnectionPoolDataSource.");
-        }
-        if (dataSourceName != null)
-        {
-            throw new IllegalStateException(
-                "The DataSourceName has already been set. " +
-                "It cannot be altered.");
+            throw new IllegalStateException("Cannot set the JNDI name for the 
DataSource, if already "
+                    + "set using setConnectionPoolDataSource.");
+        }
+        if (dataSourceName != null) {
+            throw new IllegalStateException("The DataSourceName has already 
been set. " + "It cannot be altered.");
         }
         this.dataSourceName = v;
         instanceKey = InstanceKeyDataSourceFactory.registerNewInstance(this);
     }
 
     /**
-     * Get the value of defaultAutoCommit, which defines the state of
-     * connections handed out from this pool.  The value can be changed
-     * on the Connection using Connection.setAutoCommit(boolean).
-     * The default is <code>null</code> which will use the default value for 
the
-     * drive.
+     * Gets the value of defaultAutoCommit, which defines the state of 
connections handed out from this pool. The value
+     * can be changed on the Connection using 
Connection.setAutoCommit(boolean). The default is <code>null</code> which
+     * will use the default value for the drive.
      *
      * @return value of defaultAutoCommit.
      */
@@ -570,13 +590,12 @@ public abstract class InstanceKeyDataSou
     }
 
     /**
-     * Set the value of defaultAutoCommit, which defines the state of
-     * connections handed out from this pool.  The value can be changed
-     * on the Connection using Connection.setAutoCommit(boolean).
-     * The default is <code>null</code> which will use the default value for 
the
-     * drive.
+     * Sets the value of defaultAutoCommit, which defines the state of 
connections handed out from this pool. The value
+     * can be changed on the Connection using 
Connection.setAutoCommit(boolean). The default is <code>null</code> which
+     * will use the default value for the drive.
      *
-     * @param v  Value to assign to defaultAutoCommit.
+     * @param v
+     *            Value to assign to defaultAutoCommit.
      */
     public void setDefaultAutoCommit(final Boolean v) {
         assertInitializationAllowed();
@@ -584,11 +603,9 @@ public abstract class InstanceKeyDataSou
     }
 
     /**
-     * Get the value of defaultReadOnly, which defines the state of
-     * connections handed out from this pool.  The value can be changed
-     * on the Connection using Connection.setReadOnly(boolean).
-     * The default is <code>null</code> which will use the default value for 
the
-     * drive.
+     * Gets the value of defaultReadOnly, which defines the state of 
connections handed out from this pool. The value
+     * can be changed on the Connection using Connection.setReadOnly(boolean). 
The default is <code>null</code> which
+     * will use the default value for the drive.
      *
      * @return value of defaultReadOnly.
      */
@@ -597,13 +614,12 @@ public abstract class InstanceKeyDataSou
     }
 
     /**
-     * Set the value of defaultReadOnly, which defines the state of
-     * connections handed out from this pool.  The value can be changed
-     * on the Connection using Connection.setReadOnly(boolean).
-     * The default is <code>null</code> which will use the default value for 
the
-     * drive.
+     * Sets the value of defaultReadOnly, which defines the state of 
connections handed out from this pool. The value
+     * can be changed on the Connection using Connection.setReadOnly(boolean). 
The default is <code>null</code> which
+     * will use the default value for the drive.
      *
-     * @param v  Value to assign to defaultReadOnly.
+     * @param v
+     *            Value to assign to defaultReadOnly.
      */
     public void setDefaultReadOnly(final Boolean v) {
         assertInitializationAllowed();
@@ -611,10 +627,9 @@ public abstract class InstanceKeyDataSou
     }
 
     /**
-     * Get the value of defaultTransactionIsolation, which defines the state of
-     * connections handed out from this pool.  The value can be changed
-     * on the Connection using Connection.setTransactionIsolation(int).
-     * If this method returns -1, the default is JDBC driver dependent.
+     * Gets the value of defaultTransactionIsolation, which defines the state 
of connections handed out from this pool.
+     * The value can be changed on the Connection using 
Connection.setTransactionIsolation(int). If this method returns
+     * -1, the default is JDBC driver dependent.
      *
      * @return value of defaultTransactionIsolation.
      */
@@ -623,12 +638,12 @@ public abstract class InstanceKeyDataSou
     }
 
     /**
-     * Set the value of defaultTransactionIsolation, which defines the state of
-     * connections handed out from this pool.  The value can be changed
-     * on the Connection using Connection.setTransactionIsolation(int).
-     * The default is JDBC driver dependent.
+     * Sets the value of defaultTransactionIsolation, which defines the state 
of connections handed out from this pool.
+     * The value can be changed on the Connection using 
Connection.setTransactionIsolation(int). The default is JDBC
+     * driver dependent.
      *
-     * @param v  Value to assign to defaultTransactionIsolation
+     * @param v
+     *            Value to assign to defaultTransactionIsolation
      */
     public void setDefaultTransactionIsolation(final int v) {
         assertInitializationAllowed();
@@ -646,9 +661,8 @@ public abstract class InstanceKeyDataSou
     }
 
     /**
-     * Get the description.  This property is defined by JDBC as for use with
-     * GUI (or other) tools that might deploy the datasource.  It serves no
-     * internal purpose.
+     * Gets the description. This property is defined by JDBC as for use with 
GUI (or other) tools that might deploy the
+     * datasource. It serves no internal purpose.
      *
      * @return value of description.
      */
@@ -657,11 +671,11 @@ public abstract class InstanceKeyDataSou
     }
 
     /**
-     * Set the description.  This property is defined by JDBC as for use with
-     * GUI (or other) tools that might deploy the datasource.  It serves no
-     * internal purpose.
+     * Sets the description. This property is defined by JDBC as for use with 
GUI (or other) tools that might deploy the
+     * datasource. It serves no internal purpose.
      *
-     * @param v  Value to assign to description.
+     * @param v
+     *            Value to assign to description.
      */
     public void setDescription(final String v) {
         this.description = v;
@@ -672,10 +686,11 @@ public abstract class InstanceKeyDataSou
     }
 
     /**
-     * Get the value of jndiEnvironment which is used when instantiating
-     * a jndi InitialContext.  This InitialContext is used to locate the
-     * backend ConnectionPoolDataSource.
+     * Gets the value of jndiEnvironment which is used when instantiating a 
JNDI InitialContext. This InitialContext is
+     * used to locate the backend ConnectionPoolDataSource.
      *
+     * @param key
+     *            JNDI environment key.
      * @return value of jndiEnvironment.
      */
     public String getJndiEnvironment(final String key) {
@@ -687,12 +702,13 @@ public abstract class InstanceKeyDataSou
     }
 
     /**
-     * Sets the value of the given JNDI environment property to be used when
-     * instantiating a JNDI InitialContext. This InitialContext is used to
-     * locate the backend ConnectionPoolDataSource.
+     * Sets the value of the given JNDI environment property to be used when 
instantiating a JNDI InitialContext. This
+     * InitialContext is used to locate the backend ConnectionPoolDataSource.
      *
-     * @param key the JNDI environment property to set.
-     * @param value the value assigned to specified JNDI environment property.
+     * @param key
+     *            the JNDI environment property to set.
+     * @param value
+     *            the value assigned to specified JNDI environment property.
      */
     public void setJndiEnvironment(final String key, final String value) {
         if (jndiEnvironment == null) {
@@ -702,12 +718,11 @@ public abstract class InstanceKeyDataSou
     }
 
     /**
-     * Sets the JNDI environment to be used when instantiating a JNDI
-     * InitialContext. This InitialContext is used to locate the backend
-     * ConnectionPoolDataSource.
+     * Sets the JNDI environment to be used when instantiating a JNDI 
InitialContext. This InitialContext is used to
+     * locate the backend ConnectionPoolDataSource.
      *
-     * @param properties the JNDI environment property to set which will
-     *                   overwrite any current settings
+     * @param properties
+     *            the JNDI environment property to set which will overwrite 
any current settings
      */
     void setJndiEnvironment(final Properties properties) {
         if (jndiEnvironment == null) {
@@ -719,7 +734,8 @@ public abstract class InstanceKeyDataSou
     }
 
     /**
-     * Get the value of loginTimeout.
+     * Gets the value of loginTimeout.
+     *
      * @return value of loginTimeout.
      */
     @Override
@@ -728,8 +744,10 @@ public abstract class InstanceKeyDataSou
     }
 
     /**
-     * Set the value of loginTimeout.
-     * @param v  Value to assign to loginTimeout.
+     * Sets the value of loginTimeout.
+     *
+     * @param v
+     *            Value to assign to loginTimeout.
      */
     @Override
     public void setLoginTimeout(final int v) {
@@ -737,21 +755,23 @@ public abstract class InstanceKeyDataSou
     }
 
     /**
-     * Get the value of logWriter.
+     * Gets the value of logWriter.
+     *
      * @return value of logWriter.
      */
     @Override
     public PrintWriter getLogWriter() {
         if (logWriter == null) {
-            logWriter = new PrintWriter(
-                    new OutputStreamWriter(System.out, 
StandardCharsets.UTF_8));
+            logWriter = new PrintWriter(new OutputStreamWriter(System.out, 
StandardCharsets.UTF_8));
         }
         return logWriter;
     }
 
     /**
-     * Set the value of logWriter.
-     * @param v  Value to assign to logWriter.
+     * Sets the value of logWriter.
+     *
+     * @param v
+     *            Value to assign to logWriter.
      */
     @Override
     public void setLogWriter(final PrintWriter v) {
@@ -759,22 +779,25 @@ public abstract class InstanceKeyDataSou
     }
 
     /**
-     * The SQL query that will be used to validate connections from this pool
-     * before returning them to the caller.  If specified, this query
-     * <strong>MUST</strong> be an SQL SELECT statement that returns at least
-     * one row. If not specified, {@link Connection#isValid(int)} will be used
-     * to validate connections.
+     * Gets the SQL query that will be used to validate connections from this 
pool before returning them to the caller.
+     * If specified, this query <strong>MUST</strong> be an SQL SELECT 
statement that returns at least one row. If not
+     * specified, {@link Connection#isValid(int)} will be used to validate 
connections.
+     *
+     * @return The SQL query that will be used to validate connections from 
this pool before returning them to the
+     *         caller.
      */
     public String getValidationQuery() {
         return this.validationQuery;
     }
 
     /**
-     * The SQL query that will be used to validate connections from this pool
-     * before returning them to the caller.  If specified, this query
-     * <strong>MUST</strong> be an SQL SELECT statement that returns at least
-     * one row. If not specified, connections will be validated using
-     * {@link Connection#isValid(int)}.
+     * Sets the SQL query that will be used to validate connections from this 
pool before returning them to the caller.
+     * If specified, this query <strong>MUST</strong> be an SQL SELECT 
statement that returns at least one row. If not
+     * specified, connections will be validated using {@link 
Connection#isValid(int)}.
+     *
+     * @param validationQuery
+     *            The SQL query that will be used to validate connections from 
this pool before returning them to the
+     *            caller.
      */
     public void setValidationQuery(final String validationQuery) {
         assertInitializationAllowed();
@@ -783,40 +806,40 @@ public abstract class InstanceKeyDataSou
 
     /**
      * Returns the timeout in seconds before the validation query fails.
+     *
+     * @return The timeout in seconds before the validation query fails.
      */
     public int getValidationQueryTimeout() {
-        return validationQueryTimeout;
+        return validationQueryTimeoutSeconds;
     }
 
     /**
      * Sets the timeout in seconds before the validation query fails.
      *
-     * @param validationQueryTimeout    The new timeout in seconds
+     * @param validationQueryTimeoutSeconds
+     *            The new timeout in seconds
      */
-    public void setValidationQueryTimeout(final int validationQueryTimeout) {
-        this.validationQueryTimeout = validationQueryTimeout;
+    public void setValidationQueryTimeout(final int 
validationQueryTimeoutSeconds) {
+        this.validationQueryTimeoutSeconds = validationQueryTimeoutSeconds;
     }
 
     /**
-     * Whether a rollback will be issued after executing the SQL query
-     * that will be used to validate connections from this pool
-     * before returning them to the caller.
+     * Whether a rollback will be issued after executing the SQL query that 
will be used to validate connections from
+     * this pool before returning them to the caller.
      *
-     * @return true if a rollback will be issued after executing the
-     * validation query
+     * @return true if a rollback will be issued after executing the 
validation query
      */
     public boolean isRollbackAfterValidation() {
         return this.rollbackAfterValidation;
     }
 
     /**
-     * Whether a rollback will be issued after executing the SQL query
-     * that will be used to validate connections from this pool
-     * before returning them to the caller. Default behavior is NOT
-     * to issue a rollback. The setting will only have an effect
-     * if a validation query is set
+     * Whether a rollback will be issued after executing the SQL query that 
will be used to validate connections from
+     * this pool before returning them to the caller. Default behavior is NOT 
to issue a rollback. The setting will only
+     * have an effect if a validation query is set
      *
-     * @param rollbackAfterValidation new property value
+     * @param rollbackAfterValidation
+     *            new property value
      */
     public void setRollbackAfterValidation(final boolean 
rollbackAfterValidation) {
         assertInitializationAllowed();
@@ -824,21 +847,30 @@ public abstract class InstanceKeyDataSou
     }
 
     /**
-     * Returns the maximum permitted lifetime of a connection in milliseconds. 
A
-     * value of zero or less indicates an infinite lifetime.
+     * Returns the maximum permitted lifetime of a connection in milliseconds. 
A value of zero or less indicates an
+     * infinite lifetime.
+     *
+     * @return The maximum permitted lifetime of a connection in milliseconds. 
A value of zero or less indicates an
+     *         infinite lifetime.
      */
     public long getMaxConnLifetimeMillis() {
         return maxConnLifetimeMillis;
     }
 
     /**
-     * <p>Sets the maximum permitted lifetime of a connection in
-     * milliseconds. A value of zero or less indicates an infinite 
lifetime.</p>
      * <p>
-     * Note: this method currently has no effect once the pool has been
-     * initialized.  The pool is initialized the first time one of the
-     * following methods is invoked: <code>getConnection, setLogwriter,
-     * setLoginTimeout, getLoginTimeout, getLogWriter.</code></p>
+     * Sets the maximum permitted lifetime of a connection in milliseconds. A 
value of zero or less indicates an
+     * infinite lifetime.
+     * </p>
+     * <p>
+     * Note: this method currently has no effect once the pool has been 
initialized. The pool is initialized the first
+     * time one of the following methods is invoked: <code>getConnection, 
setLogwriter,
+     * setLoginTimeout, getLoginTimeout, getLogWriter.</code>
+     * </p>
+     *
+     * @param maxConnLifetimeMillis
+     *            The maximum permitted lifetime of a connection in 
milliseconds. A value of zero or less indicates an
+     *            infinite lifetime.
      */
     public void setMaxConnLifetimeMillis(final long maxConnLifetimeMillis) {
         this.maxConnLifetimeMillis = maxConnLifetimeMillis;
@@ -851,7 +883,7 @@ public abstract class InstanceKeyDataSou
     // DataSource implementation
 
     /**
-     * Attempt to establish a database connection.
+     * Attempts to establish a database connection.
      */
     @Override
     public Connection getConnection() throws SQLException {
@@ -859,29 +891,26 @@ public abstract class InstanceKeyDataSou
     }
 
     /**
-     * Attempt to retrieve a database connection using {@link 
#getPooledConnectionAndInfo(String, String)}
-     * with the provided username and password.  The password on the {@link 
PooledConnectionAndInfo}
-     * instance returned by <code>getPooledConnectionAndInfo</code> is 
compared to the <code>password</code>
-     * parameter.  If the comparison fails, a database connection using the 
supplied username and password
-     * is attempted.  If the connection attempt fails, an SQLException is 
thrown, indicating that the given password
-     * did not match the password used to create the pooled connection.  If 
the connection attempt succeeds, this
-     * means that the database password has been changed.  In this case, the 
<code>PooledConnectionAndInfo</code>
-     * instance retrieved with the old password is destroyed and the 
<code>getPooledConnectionAndInfo</code> is
-     * repeatedly invoked until a <code>PooledConnectionAndInfo</code> 
instance with the new password is returned.
-     *
+     * Attempts to retrieve a database connection using {@link 
#getPooledConnectionAndInfo(String, String)} with the
+     * provided user name and password. The password on the {@link 
PooledConnectionAndInfo} instance returned by
+     * <code>getPooledConnectionAndInfo</code> is compared to the 
<code>password</code> parameter. If the comparison
+     * fails, a database connection using the supplied user name and password 
is attempted. If the connection attempt
+     * fails, an SQLException is thrown, indicating that the given password 
did not match the password used to create
+     * the pooled connection. If the connection attempt succeeds, this means 
that the database password has been
+     * changed. In this case, the <code>PooledConnectionAndInfo</code> 
instance retrieved with the old password is
+     * destroyed and the <code>getPooledConnectionAndInfo</code> is repeatedly 
invoked until a
+     * <code>PooledConnectionAndInfo</code> instance with the new password is 
returned.
      */
     @Override
-    public Connection getConnection(final String username, final String 
password)
-            throws SQLException {
+    public Connection getConnection(final String userName, final String 
userPassword) throws SQLException {
         if (instanceKey == null) {
             throw new SQLException("Must set the ConnectionPoolDataSource "
-                    + "through setDataSourceName or 
setConnectionPoolDataSource"
-                    + " before calling getConnection.");
+                    + "through setDataSourceName or 
setConnectionPoolDataSource" + " before calling getConnection.");
         }
         getConnectionCalled = true;
         PooledConnectionAndInfo info = null;
         try {
-            info = getPooledConnectionAndInfo(username, password);
+            info = getPooledConnectionAndInfo(userName, userPassword);
         } catch (final NoSuchElementException e) {
             closeDueToException(info);
             throw new SQLException("Cannot borrow connection from pool", e);
@@ -896,18 +925,17 @@ public abstract class InstanceKeyDataSou
             throw new SQLException("Cannot borrow connection from pool", e);
         }
 
-        if (!(null == password ? null == info.getPassword()
-                : password.equals(info.getPassword()))) {  // Password on 
PooledConnectionAndInfo does not match
+        // Password on PooledConnectionAndInfo does not match
+        if (!(null == userPassword ? null == info.getPassword() : 
userPassword.equals(info.getPassword()))) {
             try { // See if password has changed by attempting connection
-                testCPDS(username, password);
+                testCPDS(userName, userPassword);
             } catch (final SQLException ex) {
                 // Password has not changed, so refuse client, but return 
connection to the pool
                 closeDueToException(info);
-                throw new SQLException("Given password did not match password 
used"
-                                       + " to create the PooledConnection.", 
ex);
-            } catch (final javax.naming.NamingException ne) {
                 throw new SQLException(
-                        "NamingException encountered connecting to database", 
ne);
+                        "Given password did not match password used" + " to 
create the PooledConnection.", ex);
+            } catch (final javax.naming.NamingException ne) {
+                throw new SQLException("NamingException encountered connecting 
to database", ne);
             }
             /*
              * Password must have changed -> destroy connection and keep 
retrying until we get a new, good one,
@@ -915,12 +943,14 @@ public abstract class InstanceKeyDataSou
              */
             final UserPassKey upkey = info.getUserPassKey();
             final PooledConnectionManager manager = 
getConnectionManager(upkey);
-            manager.invalidate(info.getPooledConnection()); // Destroy and 
remove from pool
-            manager.setPassword(upkey.getPassword()); // Reset the password on 
the factory if using CPDSConnectionFactory
+            // Destroy and remove from pool
+            manager.invalidate(info.getPooledConnection());
+            // Reset the password on the factory if using CPDSConnectionFactory
+            manager.setPassword(upkey.getPassword());
             info = null;
             for (int i = 0; i < 10; i++) { // Bound the number of retries - 
only needed if bad instances return
                 try {
-                    info = getPooledConnectionAndInfo(username, password);
+                    info = getPooledConnectionAndInfo(userName, userPassword);
                 } catch (final NoSuchElementException e) {
                     closeDueToException(info);
                     throw new SQLException("Cannot borrow connection from 
pool", e);
@@ -934,7 +964,7 @@ public abstract class InstanceKeyDataSou
                     closeDueToException(info);
                     throw new SQLException("Cannot borrow connection from 
pool", e);
                 }
-                if (info != null && password != null && 
password.equals(info.getPassword())) {
+                if (info != null && userPassword != null && 
userPassword.equals(info.getPassword())) {
                     break;
                 }
                 if (info != null) {
@@ -949,27 +979,23 @@ public abstract class InstanceKeyDataSou
 
         final Connection con = info.getPooledConnection().getConnection();
         try {
-            setupDefaults(con, username);
+            setupDefaults(con, userName);
             con.clearWarnings();
             return con;
         } catch (final SQLException ex) {
             try {
                 con.close();
             } catch (final Exception exc) {
-                getLogWriter().println(
-                     "ignoring exception during close: " + exc);
+                getLogWriter().println("ignoring exception during close: " + 
exc);
             }
             throw ex;
         }
     }
 
-    protected abstract PooledConnectionAndInfo
-        getPooledConnectionAndInfo(String username, String password)
-        throws SQLException;
-
-    protected abstract void setupDefaults(Connection con, String username)
-        throws SQLException;
+    protected abstract PooledConnectionAndInfo 
getPooledConnectionAndInfo(String userName, String userPassword)
+            throws SQLException;
 
+    protected abstract void setupDefaults(Connection connection, String 
userName) throws SQLException;
 
     private void closeDueToException(final PooledConnectionAndInfo info) {
         if (info != null) {
@@ -977,17 +1003,16 @@ public abstract class InstanceKeyDataSou
                 info.getPooledConnection().getConnection().close();
             } catch (final Exception e) {
                 // do not throw this exception because we are in the middle
-                // of handling another exception.  But record it because
+                // of handling another exception. But record it because
                 // it potentially leaks connections from the pool.
-                getLogWriter().println("[ERROR] Could not return connection to 
"
-                    + "pool during exception handling. " + e.getMessage());
+                getLogWriter().println("[ERROR] Could not return connection to 
" + "pool during exception handling. "
+                        + e.getMessage());
             }
         }
     }
 
-    protected ConnectionPoolDataSource
-        testCPDS(final String username, final String password)
-        throws javax.naming.NamingException, SQLException {
+    protected ConnectionPoolDataSource testCPDS(final String userName, final 
String userPassword)
+            throws javax.naming.NamingException, SQLException {
         // The source of physical db connections
         ConnectionPoolDataSource cpds = this.dataSource;
         if (cpds == null) {
@@ -1001,33 +1026,27 @@ public abstract class InstanceKeyDataSou
             if (ds instanceof ConnectionPoolDataSource) {
                 cpds = (ConnectionPoolDataSource) ds;
             } else {
-                throw new SQLException("Illegal configuration: "
-                    + "DataSource " + dataSourceName
-                    + " (" + ds.getClass().getName() + ")"
-                    + " doesn't implement javax.sql.ConnectionPoolDataSource");
+                throw new SQLException("Illegal configuration: " + "DataSource 
" + dataSourceName + " ("
+                        + ds.getClass().getName() + ")" + " doesn't implement 
javax.sql.ConnectionPoolDataSource");
             }
         }
 
-        // try to get a connection with the supplied username/password
+        // try to get a connection with the supplied userName/password
         PooledConnection conn = null;
         try {
-            if (username != null) {
-                conn = cpds.getPooledConnection(username, password);
-            }
-            else {
+            if (userName != null) {
+                conn = cpds.getPooledConnection(userName, userPassword);
+            } else {
                 conn = cpds.getPooledConnection();
             }
             if (conn == null) {
-                throw new SQLException(
-                    "Cannot connect using the supplied username/password");
+                throw new SQLException("Cannot connect using the supplied 
userName/password");
             }
-        }
-        finally {
+        } finally {
             if (conn != null) {
                 try {
                     conn.close();
-                }
-                catch (final SQLException e) {
+                } catch (final SQLException e) {
                     // at least we could connect
                 }
             }

Modified: 
tomcat/tc8.0.x/trunk/java/org/apache/tomcat/dbcp/dbcp2/datasources/InstanceKeyDataSourceFactory.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc8.0.x/trunk/java/org/apache/tomcat/dbcp/dbcp2/datasources/InstanceKeyDataSourceFactory.java?rev=1833816&r1=1833815&r2=1833816&view=diff
==============================================================================
--- 
tomcat/tc8.0.x/trunk/java/org/apache/tomcat/dbcp/dbcp2/datasources/InstanceKeyDataSourceFactory.java
 (original)
+++ 
tomcat/tc8.0.x/trunk/java/org/apache/tomcat/dbcp/dbcp2/datasources/InstanceKeyDataSourceFactory.java
 Tue Jun 19 11:21:13 2018
@@ -19,8 +19,10 @@ package org.apache.tomcat.dbcp.dbcp2.dat
 import java.io.ByteArrayInputStream;
 import java.io.IOException;
 import java.io.ObjectInputStream;
+import java.util.ArrayList;
 import java.util.Hashtable;
 import java.util.Iterator;
+import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
 import java.util.Properties;
@@ -32,22 +34,22 @@ import javax.naming.RefAddr;
 import javax.naming.Reference;
 import javax.naming.spi.ObjectFactory;
 
+import org.apache.tomcat.dbcp.dbcp2.ListException;
+
 /**
- * A JNDI ObjectFactory which creates <code>SharedPoolDataSource</code>s
- * or <code>PerUserPoolDataSource</code>s
+ * A JNDI ObjectFactory which creates <code>SharedPoolDataSource</code>s or 
<code>PerUserPoolDataSource</code>s
  *
  * @since 2.0
  */
 abstract class InstanceKeyDataSourceFactory implements ObjectFactory {
 
-    private static final Map<String, InstanceKeyDataSource> instanceMap =
-            new ConcurrentHashMap<>();
+    private static final Map<String, InstanceKeyDataSource> instanceMap = new 
ConcurrentHashMap<>();
 
     static synchronized String registerNewInstance(final InstanceKeyDataSource 
ds) {
         int max = 0;
-        final Iterator<String> i = instanceMap.keySet().iterator();
-        while (i.hasNext()) {
-            final String s = i.next();
+        final Iterator<String> iterator = instanceMap.keySet().iterator();
+        while (iterator.hasNext()) {
+            final String s = iterator.next();
             if (s != null) {
                 try {
                     max = Math.max(max, Integer.parseInt(s));
@@ -57,8 +59,8 @@ abstract class InstanceKeyDataSourceFact
             }
         }
         final String instanceKey = String.valueOf(max + 1);
-        // put a placeholder here for now, so other instances will not
-        // take our key.  we will replace with a pool when ready.
+        // Put a placeholder here for now, so other instances will not
+        // take our key. We will replace with a pool when ready.
         instanceMap.put(instanceKey, ds);
         return instanceKey;
     }
@@ -70,56 +72,70 @@ abstract class InstanceKeyDataSourceFact
     }
 
     /**
-     * Close all pools associated with this class.
+     * Closes all pools associated with this class.
+     *
+     * @throws Exception
+     *             a {@link ListException} containing all exceptions thrown by 
{@link InstanceKeyDataSource#close()}
+     * @see InstanceKeyDataSource#close()
+     * @see ListException
+     * @since 2.4.0 throws a {@link ListException} instead of, in 2.3.0 and 
before, the first exception thrown by
+     *        {@link InstanceKeyDataSource#close()}.
      */
     public static void closeAll() throws Exception {
-        //Get iterator to loop over all instances of this datasource.
-        final Iterator<Entry<String,InstanceKeyDataSource>> instanceIterator =
-            instanceMap.entrySet().iterator();
+        // Get iterator to loop over all instances of this data source.
+        final List<Throwable> exceptionList = new 
ArrayList<>(instanceMap.size());
+        final Iterator<Entry<String, InstanceKeyDataSource>> instanceIterator 
= instanceMap.entrySet().iterator();
         while (instanceIterator.hasNext()) {
-            instanceIterator.next().getValue().close();
+            // Bullet-proof to avoid anything else but problems from 
InstanceKeyDataSource#close().
+            final Entry<String, InstanceKeyDataSource> next = 
instanceIterator.next();
+            if (next != null) {
+                @SuppressWarnings("resource")
+                final InstanceKeyDataSource value = next.getValue();
+                if (value != null) {
+                    try {
+                        value.close();
+                    } catch (final Exception e) {
+                        exceptionList.add(e);
+                    }
+                }
+            }
         }
         instanceMap.clear();
+        if (!exceptionList.isEmpty()) {
+            throw new ListException("Could not close all InstanceKeyDataSource 
instances.", exceptionList);
+        }
     }
 
-
     /**
-     * implements ObjectFactory to create an instance of SharedPoolDataSource
-     * or PerUserPoolDataSource
+     * Implements ObjectFactory to create an instance of SharedPoolDataSource 
or PerUserPoolDataSource
      */
     @Override
-    public Object getObjectInstance(final Object refObj, final Name name,
-                                    final Context context, final 
Hashtable<?,?> env)
-        throws IOException, ClassNotFoundException {
+    public Object getObjectInstance(final Object refObj, final Name name, 
final Context context,
+            final Hashtable<?, ?> env) throws IOException, 
ClassNotFoundException {
         // The spec says to return null if we can't create an instance
         // of the reference
         Object obj = null;
         if (refObj instanceof Reference) {
             final Reference ref = (Reference) refObj;
             if (isCorrectClass(ref.getClassName())) {
-                final RefAddr ra = ref.get("instanceKey");
-                if (ra != null && ra.getContent() != null) {
+                final RefAddr refAddr = ref.get("instanceKey");
+                if (refAddr != null && refAddr.getContent() != null) {
                     // object was bound to jndi via Referenceable api.
-                    obj = instanceMap.get(ra.getContent());
-                }
-                else
-                {
-                    // tomcat jndi creates a Reference out of server.xml
+                    obj = instanceMap.get(refAddr.getContent());
+                } else {
+                    // Tomcat JNDI creates a Reference out of server.xml
                     // <ResourceParam> configuration and passes it to an
                     // instance of the factory given in server.xml.
                     String key = null;
-                    if (name != null)
-                    {
+                    if (name != null) {
                         key = name.toString();
                         obj = instanceMap.get(key);
                     }
-                    if (obj == null)
-                    {
+                    if (obj == null) {
                         final InstanceKeyDataSource ds = getNewInstance(ref);
                         setCommonProperties(ref, ds);
                         obj = ds;
-                        if (key != null)
-                        {
+                        if (key != null) {
                             instanceMap.put(key, ds);
                         }
                     }
@@ -129,188 +145,161 @@ abstract class InstanceKeyDataSourceFact
         return obj;
     }
 
-    private void setCommonProperties(final Reference ref,
-                                     final InstanceKeyDataSource ikds)
-        throws IOException, ClassNotFoundException {
+    private void setCommonProperties(final Reference ref, final 
InstanceKeyDataSource ikds)
+            throws IOException, ClassNotFoundException {
 
-        RefAddr ra = ref.get("dataSourceName");
-        if (ra != null && ra.getContent() != null) {
-            ikds.setDataSourceName(ra.getContent().toString());
+        RefAddr refAddr = ref.get("dataSourceName");
+        if (refAddr != null && refAddr.getContent() != null) {
+            ikds.setDataSourceName(refAddr.getContent().toString());
         }
 
-        ra = ref.get("description");
-        if (ra != null && ra.getContent() != null) {
-            ikds.setDescription(ra.getContent().toString());
+        refAddr = ref.get("description");
+        if (refAddr != null && refAddr.getContent() != null) {
+            ikds.setDescription(refAddr.getContent().toString());
         }
 
-        ra = ref.get("jndiEnvironment");
-        if (ra != null  && ra.getContent() != null) {
-            final byte[] serialized = (byte[]) ra.getContent();
+        refAddr = ref.get("jndiEnvironment");
+        if (refAddr != null && refAddr.getContent() != null) {
+            final byte[] serialized = (byte[]) refAddr.getContent();
             ikds.setJndiEnvironment((Properties) deserialize(serialized));
         }
 
-        ra = ref.get("loginTimeout");
-        if (ra != null && ra.getContent() != null) {
-            ikds.setLoginTimeout(
-                Integer.parseInt(ra.getContent().toString()));
+        refAddr = ref.get("loginTimeout");
+        if (refAddr != null && refAddr.getContent() != null) {
+            
ikds.setLoginTimeout(Integer.parseInt(refAddr.getContent().toString()));
         }
 
         // Pool properties
-        ra = ref.get("blockWhenExhausted");
-        if (ra != null && ra.getContent() != null) {
-            ikds.setDefaultBlockWhenExhausted(Boolean.valueOf(
-                ra.getContent().toString()).booleanValue());
+        refAddr = ref.get("blockWhenExhausted");
+        if (refAddr != null && refAddr.getContent() != null) {
+            
ikds.setDefaultBlockWhenExhausted(Boolean.valueOf(refAddr.getContent().toString()).booleanValue());
         }
 
-        ra = ref.get("evictionPolicyClassName");
-        if (ra != null && ra.getContent() != null) {
-            ikds.setDefaultEvictionPolicyClassName(ra.getContent().toString());
+        refAddr = ref.get("evictionPolicyClassName");
+        if (refAddr != null && refAddr.getContent() != null) {
+            
ikds.setDefaultEvictionPolicyClassName(refAddr.getContent().toString());
         }
 
         // Pool properties
-        ra = ref.get("lifo");
-        if (ra != null && ra.getContent() != null) {
-            ikds.setDefaultLifo(Boolean.valueOf(
-                ra.getContent().toString()).booleanValue());
+        refAddr = ref.get("lifo");
+        if (refAddr != null && refAddr.getContent() != null) {
+            
ikds.setDefaultLifo(Boolean.valueOf(refAddr.getContent().toString()).booleanValue());
         }
 
-        ra = ref.get("maxIdlePerKey");
-        if (ra != null && ra.getContent() != null) {
-            ikds.setDefaultMaxIdle(
-                Integer.parseInt(ra.getContent().toString()));
+        refAddr = ref.get("maxIdlePerKey");
+        if (refAddr != null && refAddr.getContent() != null) {
+            
ikds.setDefaultMaxIdle(Integer.parseInt(refAddr.getContent().toString()));
         }
 
-        ra = ref.get("maxTotalPerKey");
-        if (ra != null && ra.getContent() != null) {
-            ikds.setDefaultMaxTotal(
-                Integer.parseInt(ra.getContent().toString()));
+        refAddr = ref.get("maxTotalPerKey");
+        if (refAddr != null && refAddr.getContent() != null) {
+            
ikds.setDefaultMaxTotal(Integer.parseInt(refAddr.getContent().toString()));
         }
 
-        ra = ref.get("maxWaitMillis");
-        if (ra != null && ra.getContent() != null) {
-            ikds.setDefaultMaxWaitMillis(
-                Long.parseLong(ra.getContent().toString()));
+        refAddr = ref.get("maxWaitMillis");
+        if (refAddr != null && refAddr.getContent() != null) {
+            
ikds.setDefaultMaxWaitMillis(Long.parseLong(refAddr.getContent().toString()));
         }
 
-        ra = ref.get("minEvictableIdleTimeMillis");
-        if (ra != null && ra.getContent() != null) {
-            ikds.setDefaultMinEvictableIdleTimeMillis(
-                Long.parseLong(ra.getContent().toString()));
+        refAddr = ref.get("minEvictableIdleTimeMillis");
+        if (refAddr != null && refAddr.getContent() != null) {
+            
ikds.setDefaultMinEvictableIdleTimeMillis(Long.parseLong(refAddr.getContent().toString()));
         }
 
-        ra = ref.get("minIdlePerKey");
-        if (ra != null && ra.getContent() != null) {
-            ikds.setDefaultMinIdle(
-                Integer.parseInt(ra.getContent().toString()));
+        refAddr = ref.get("minIdlePerKey");
+        if (refAddr != null && refAddr.getContent() != null) {
+            
ikds.setDefaultMinIdle(Integer.parseInt(refAddr.getContent().toString()));
         }
 
-        ra = ref.get("numTestsPerEvictionRun");
-        if (ra != null && ra.getContent() != null) {
-            ikds.setDefaultNumTestsPerEvictionRun(
-                Integer.parseInt(ra.getContent().toString()));
+        refAddr = ref.get("numTestsPerEvictionRun");
+        if (refAddr != null && refAddr.getContent() != null) {
+            
ikds.setDefaultNumTestsPerEvictionRun(Integer.parseInt(refAddr.getContent().toString()));
         }
 
-        ra = ref.get("softMinEvictableIdleTimeMillis");
-        if (ra != null && ra.getContent() != null) {
-            ikds.setDefaultSoftMinEvictableIdleTimeMillis(
-                Long.parseLong(ra.getContent().toString()));
+        refAddr = ref.get("softMinEvictableIdleTimeMillis");
+        if (refAddr != null && refAddr.getContent() != null) {
+            
ikds.setDefaultSoftMinEvictableIdleTimeMillis(Long.parseLong(refAddr.getContent().toString()));
         }
 
-        ra = ref.get("testOnCreate");
-        if (ra != null && ra.getContent() != null) {
-            ikds.setDefaultTestOnCreate(Boolean.valueOf(
-                ra.getContent().toString()).booleanValue());
+        refAddr = ref.get("testOnCreate");
+        if (refAddr != null && refAddr.getContent() != null) {
+            
ikds.setDefaultTestOnCreate(Boolean.valueOf(refAddr.getContent().toString()).booleanValue());
         }
 
-        ra = ref.get("testOnBorrow");
-        if (ra != null && ra.getContent() != null) {
-            ikds.setDefaultTestOnBorrow(Boolean.valueOf(
-                ra.getContent().toString()).booleanValue());
+        refAddr = ref.get("testOnBorrow");
+        if (refAddr != null && refAddr.getContent() != null) {
+            
ikds.setDefaultTestOnBorrow(Boolean.valueOf(refAddr.getContent().toString()).booleanValue());
         }
 
-        ra = ref.get("testOnReturn");
-        if (ra != null && ra.getContent() != null) {
-            ikds.setDefaultTestOnReturn(Boolean.valueOf(
-                ra.getContent().toString()).booleanValue());
+        refAddr = ref.get("testOnReturn");
+        if (refAddr != null && refAddr.getContent() != null) {
+            
ikds.setDefaultTestOnReturn(Boolean.valueOf(refAddr.getContent().toString()).booleanValue());
         }
 
-        ra = ref.get("testWhileIdle");
-        if (ra != null && ra.getContent() != null) {
-            ikds.setDefaultTestWhileIdle(Boolean.valueOf(
-                ra.getContent().toString()).booleanValue());
+        refAddr = ref.get("testWhileIdle");
+        if (refAddr != null && refAddr.getContent() != null) {
+            
ikds.setDefaultTestWhileIdle(Boolean.valueOf(refAddr.getContent().toString()).booleanValue());
         }
 
-        ra = ref.get("timeBetweenEvictionRunsMillis");
-        if (ra != null && ra.getContent() != null) {
-            ikds.setDefaultTimeBetweenEvictionRunsMillis(
-                Long.parseLong(ra.getContent().toString()));
+        refAddr = ref.get("timeBetweenEvictionRunsMillis");
+        if (refAddr != null && refAddr.getContent() != null) {
+            
ikds.setDefaultTimeBetweenEvictionRunsMillis(Long.parseLong(refAddr.getContent().toString()));
         }
 
-
         // Connection factory properties
 
-        ra = ref.get("validationQuery");
-        if (ra != null && ra.getContent() != null) {
-            ikds.setValidationQuery(ra.getContent().toString());
+        refAddr = ref.get("validationQuery");
+        if (refAddr != null && refAddr.getContent() != null) {
+            ikds.setValidationQuery(refAddr.getContent().toString());
         }
 
-        ra = ref.get("validationQueryTimeout");
-        if (ra != null && ra.getContent() != null) {
-            ikds.setValidationQueryTimeout(Integer.parseInt(
-                    ra.getContent().toString()));
+        refAddr = ref.get("validationQueryTimeout");
+        if (refAddr != null && refAddr.getContent() != null) {
+            
ikds.setValidationQueryTimeout(Integer.parseInt(refAddr.getContent().toString()));
         }
 
-        ra = ref.get("rollbackAfterValidation");
-        if (ra != null && ra.getContent() != null) {
-            ikds.setRollbackAfterValidation(Boolean.valueOf(
-                ra.getContent().toString()).booleanValue());
+        refAddr = ref.get("rollbackAfterValidation");
+        if (refAddr != null && refAddr.getContent() != null) {
+            
ikds.setRollbackAfterValidation(Boolean.valueOf(refAddr.getContent().toString()).booleanValue());
         }
 
-        ra = ref.get("maxConnLifetimeMillis");
-        if (ra != null && ra.getContent() != null) {
-            ikds.setMaxConnLifetimeMillis(
-                Long.parseLong(ra.getContent().toString()));
+        refAddr = ref.get("maxConnLifetimeMillis");
+        if (refAddr != null && refAddr.getContent() != null) {
+            
ikds.setMaxConnLifetimeMillis(Long.parseLong(refAddr.getContent().toString()));
         }
 
-
         // Connection properties
 
-        ra = ref.get("defaultAutoCommit");
-        if (ra != null && ra.getContent() != null) {
-            
ikds.setDefaultAutoCommit(Boolean.valueOf(ra.getContent().toString()));
+        refAddr = ref.get("defaultAutoCommit");
+        if (refAddr != null && refAddr.getContent() != null) {
+            
ikds.setDefaultAutoCommit(Boolean.valueOf(refAddr.getContent().toString()));
         }
 
-        ra = ref.get("defaultTransactionIsolation");
-        if (ra != null && ra.getContent() != null) {
-            ikds.setDefaultTransactionIsolation(
-                Integer.parseInt(ra.getContent().toString()));
+        refAddr = ref.get("defaultTransactionIsolation");
+        if (refAddr != null && refAddr.getContent() != null) {
+            
ikds.setDefaultTransactionIsolation(Integer.parseInt(refAddr.getContent().toString()));
         }
 
-        ra = ref.get("defaultReadOnly");
-        if (ra != null && ra.getContent() != null) {
-            
ikds.setDefaultReadOnly(Boolean.valueOf(ra.getContent().toString()));
+        refAddr = ref.get("defaultReadOnly");
+        if (refAddr != null && refAddr.getContent() != null) {
+            
ikds.setDefaultReadOnly(Boolean.valueOf(refAddr.getContent().toString()));
         }
     }
 
-
     /**
-     * @return true if and only if className is the value returned
-     * from getClass().getName().toString()
+     * @return true if and only if className is the value returned from 
getClass().getName().toString()
      */
     protected abstract boolean isCorrectClass(String className);
 
     /**
-     * Creates an instance of the subclass and sets any properties
-     * contained in the Reference.
+     * Creates an instance of the subclass and sets any properties contained 
in the Reference.
      */
-    protected abstract InstanceKeyDataSource getNewInstance(Reference ref)
-        throws IOException, ClassNotFoundException;
+    protected abstract InstanceKeyDataSource getNewInstance(Reference ref) 
throws IOException, ClassNotFoundException;
 
     /**
-     * used to set some properties saved within a Reference
+     * Sets some properties saved within a Reference
      */
-    protected static final Object deserialize(final byte[] data)
-        throws IOException, ClassNotFoundException {
+    protected static final Object deserialize(final byte[] data) throws 
IOException, ClassNotFoundException {
         ObjectInputStream in = null;
         try {
             in = new ObjectInputStream(new ByteArrayInputStream(data));
@@ -320,9 +309,9 @@ abstract class InstanceKeyDataSourceFact
                 try {
                     in.close();
                 } catch (final IOException ex) {
+                    // ignore
                 }
             }
         }
     }
 }
-



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to