This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/master by this push:
     new 253283a  Update Commons Pool to 2.8.1
253283a is described below

commit 253283a5927a449bb10ba4396b8eb41680b78132
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Wed Aug 26 14:09:38 2020 +0100

    Update Commons Pool to 2.8.1
---
 MERGE.txt                                          |  10 +-
 .../dbcp/pool2/BaseKeyedPooledObjectFactory.java   |   4 +-
 .../apache/tomcat/dbcp/pool2/BaseObjectPool.java   |   8 +-
 .../tomcat/dbcp/pool2/BasePooledObjectFactory.java |   2 +-
 .../apache/tomcat/dbcp/pool2/KeyedObjectPool.java  |  44 ++---
 .../dbcp/pool2/KeyedPooledObjectFactory.java       |  16 +-
 java/org/apache/tomcat/dbcp/pool2/ObjectPool.java  |  10 +-
 java/org/apache/tomcat/dbcp/pool2/PoolUtils.java   |  70 ++++---
 .../org/apache/tomcat/dbcp/pool2/PooledObject.java |   4 +-
 .../tomcat/dbcp/pool2/PooledObjectFactory.java     |  12 +-
 .../tomcat/dbcp/pool2/impl/AbandonedConfig.java    |  10 +-
 .../dbcp/pool2/impl/BaseGenericObjectPool.java     | 213 ++++++++++++---------
 .../dbcp/pool2/impl/BaseObjectPoolConfig.java      |   6 +-
 .../tomcat/dbcp/pool2/impl/CallStackUtils.java     |   6 +-
 .../dbcp/pool2/impl/DefaultPooledObject.java       |   4 +-
 .../pool2/impl/DefaultPooledObjectInfoMBean.java   |   6 +-
 .../tomcat/dbcp/pool2/impl/EvictionPolicy.java     |   4 +-
 .../tomcat/dbcp/pool2/impl/EvictionTimer.java      | 118 ++++++++++--
 .../dbcp/pool2/impl/GenericKeyedObjectPool.java    |  40 ++--
 .../tomcat/dbcp/pool2/impl/GenericObjectPool.java  |  24 +--
 .../dbcp/pool2/impl/LinkedBlockingDeque.java       |  33 +---
 .../dbcp/pool2/impl/SecurityManagerCallStack.java  |   2 +-
 .../dbcp/pool2/impl/SoftReferenceObjectPool.java   |  16 +-
 23 files changed, 392 insertions(+), 270 deletions(-)

diff --git a/MERGE.txt b/MERGE.txt
index 088393b..79fc82e 100644
--- a/MERGE.txt
+++ b/MERGE.txt
@@ -42,7 +42,7 @@ Codec
 -----
 Sub-tree:
 src/main/java/org/apache/commons/codec
-The SHA1 ID for the most recent commit to be merged to Tomcat is:
+The SHA1 ID / tag for the most recent commit to be merged to Tomcat is:
 53c93d0ffccb65d182306c74d1230ce814889dc1 (2020-08-18)
 Note: Only classes required for Base64 encoding/decoding. The rest are removed.
 
@@ -50,7 +50,7 @@ FileUpload
 ----------
 Sub-tree:
 src/main/java/org/apache/commons/fileupload2
-The SHA1 ID for the most recent commit to be merged to Tomcat is:
+The SHA1 ID / tag for the most recent commit to be merged to Tomcat is:
 c25a4e33553a5f098ab6065a54e1ae7985025d26 (2020-08-26)
 
 Note: Tomcat's copy of fileupload also includes classes copied manually from
@@ -61,12 +61,12 @@ DBCP
 Pool2
 Sub-tree
 src/main/java/org/apache/commons/pool2
-The SHA1 ID for the most recent commit to be merged to Tomcat is:
-6092f924b36061353ff92b18c88400ab3bc05327 (2019-12-06)
+The SHA1 ID / tag for the most recent commit to be merged to Tomcat is:
+rel/commons-pool-2.8.1
 
 DBCP2
 Sub-tree
 src/main/java/org/apache/commons/dbcp2
 src/main/resources/org/apache/commons/dbcp2
-The SHA1 ID for the most recent commit to be merged to Tomcat is:
+The SHA1 ID / tag for the most recent commit to be merged to Tomcat is:
 a363906bf7a039f79c07fa3c68b082a69ae035d7 (2019-12-06)
diff --git 
a/java/org/apache/tomcat/dbcp/pool2/BaseKeyedPooledObjectFactory.java 
b/java/org/apache/tomcat/dbcp/pool2/BaseKeyedPooledObjectFactory.java
index dfbc5a9..b0f0c34 100644
--- a/java/org/apache/tomcat/dbcp/pool2/BaseKeyedPooledObjectFactory.java
+++ b/java/org/apache/tomcat/dbcp/pool2/BaseKeyedPooledObjectFactory.java
@@ -17,7 +17,7 @@
 package org.apache.tomcat.dbcp.pool2;
 
 /**
- * A base implementation of <code>KeyedPooledObjectFactory</code>.
+ * A base implementation of {@code KeyedPooledObjectFactory}.
  * <p>
  * All operations defined here are essentially no-op's.
  * </p>
@@ -85,7 +85,7 @@ public abstract class BaseKeyedPooledObjectFactory<K, V> 
extends BaseObject
      *
      * @param key the key used when selecting the object
      * @param p a {@code PooledObject} wrapping the instance to be validated
-     * @return always <code>true</code> in the default implementation
+     * @return always {@code true} in the default implementation
      */
     @Override
     public boolean validateObject(final K key, final PooledObject<V> p) {
diff --git a/java/org/apache/tomcat/dbcp/pool2/BaseObjectPool.java 
b/java/org/apache/tomcat/dbcp/pool2/BaseObjectPool.java
index df23b12..d17b494 100644
--- a/java/org/apache/tomcat/dbcp/pool2/BaseObjectPool.java
+++ b/java/org/apache/tomcat/dbcp/pool2/BaseObjectPool.java
@@ -85,8 +85,8 @@ public abstract class BaseObjectPool<T> extends BaseObject 
implements ObjectPool
     /**
      * {@inheritDoc}
      * <p>
-     * This affects the behavior of <code>isClosed</code> and
-     * <code>assertOpen</code>.
+     * This affects the behavior of {@code isClosed} and
+     * {@code assertOpen}.
      * </p>
      */
     @Override
@@ -97,14 +97,14 @@ public abstract class BaseObjectPool<T> extends BaseObject 
implements ObjectPool
     /**
      * Has this pool instance been closed.
      *
-     * @return <code>true</code> when this pool has been closed.
+     * @return {@code true} when this pool has been closed.
      */
     public final boolean isClosed() {
         return closed;
     }
 
     /**
-     * Throws an <code>IllegalStateException</code> when this pool has been
+     * Throws an {@code IllegalStateException} when this pool has been
      * closed.
      *
      * @throws IllegalStateException when this pool has been closed.
diff --git a/java/org/apache/tomcat/dbcp/pool2/BasePooledObjectFactory.java 
b/java/org/apache/tomcat/dbcp/pool2/BasePooledObjectFactory.java
index 7c58532..6714324 100644
--- a/java/org/apache/tomcat/dbcp/pool2/BasePooledObjectFactory.java
+++ b/java/org/apache/tomcat/dbcp/pool2/BasePooledObjectFactory.java
@@ -17,7 +17,7 @@
 package org.apache.tomcat.dbcp.pool2;
 
 /**
- * A base implementation of <code>PoolableObjectFactory</code>.
+ * A base implementation of {@code PoolableObjectFactory}.
  * <p>
  * All operations defined here are essentially no-op's.
  * <p>
diff --git a/java/org/apache/tomcat/dbcp/pool2/KeyedObjectPool.java 
b/java/org/apache/tomcat/dbcp/pool2/KeyedObjectPool.java
index 7461d90..9e5d550 100644
--- a/java/org/apache/tomcat/dbcp/pool2/KeyedObjectPool.java
+++ b/java/org/apache/tomcat/dbcp/pool2/KeyedObjectPool.java
@@ -71,7 +71,7 @@ public interface KeyedObjectPool<K, V> extends Closeable {
     /**
      * Create an object using the {@link KeyedPooledObjectFactory factory} or
      * other implementation dependent mechanism, passivate it, and then place 
it
-     * in the idle object pool. <code>addObject</code> is useful for
+     * in the idle object pool. {@code addObject} is useful for
      * "pre-loading" a pool with idle objects (Optional operation).
      *
      * @param key the key a new instance should be added to
@@ -88,19 +88,19 @@ public interface KeyedObjectPool<K, V> extends Closeable {
 
     /**
      * Calls {@link KeyedObjectPool#addObject(Object)} with each
-     * key in <code>keys</code> for <code>count</code> number of times. This 
has
+     * key in {@code keys} for {@code count} number of times. This has
      * the same effect as calling {@link #addObjects(Object, int)}
-     * for each key in the <code>keys</code> collection.
+     * for each key in the {@code keys} collection.
      *
      * @param keys
      *            {@link Collection} of keys to add objects for.
      * @param count
-     *            the number of idle objects to add for each <code>key</code>.
+     *            the number of idle objects to add for each {@code key}.
      * @throws Exception
      *             when {@link KeyedObjectPool#addObject(Object)} fails.
      * @throws IllegalArgumentException
-     *             when <code>keyedPool</code>, <code>keys</code>, or any value
-     *             in <code>keys</code> is <code>null</code>.
+     *             when {@code keyedPool}, {@code keys}, or any value
+     *             in {@code keys} is {@code null}.
      * @see #addObjects(Object, int)
      */
     default void addObjects(final Collection<K> keys, final int count) throws 
Exception, IllegalArgumentException {
@@ -114,16 +114,16 @@ public interface KeyedObjectPool<K, V> extends Closeable {
 
     /**
      * Calls {@link KeyedObjectPool#addObject(Object)}
-     * <code>key</code> <code>count</code> number of times.
+     * {@code key} {@code count} number of times.
      *
      * @param key
      *            the key to add objects for.
      * @param count
-     *            the number of idle objects to add for <code>key</code>.
+     *            the number of idle objects to add for {@code key}.
      * @throws Exception
      *             when {@link KeyedObjectPool#addObject(Object)} fails.
      * @throws IllegalArgumentException
-     *             when <code>key</code> is <code>null</code>.
+     *             when {@code key} is {@code null}.
      * @since 2.8.0
      */
     default void addObjects(final K key, final int count) throws Exception, 
IllegalArgumentException {
@@ -136,7 +136,7 @@ public interface KeyedObjectPool<K, V> extends Closeable {
     }
 
     /**
-     * Obtains an instance from this pool for the specified <code>key</code>.
+     * Obtains an instance from this pool for the specified {@code key}.
      * <p>
      * Instances returned from this method will have been either newly created
      * with {@link KeyedPooledObjectFactory#makeObject makeObject} or will be
@@ -149,12 +149,12 @@ public interface KeyedObjectPool<K, V> extends Closeable {
      * By contract, clients <strong>must</strong> return the borrowed object
      * using {@link #returnObject returnObject},
      * {@link #invalidateObject invalidateObject}, or a related method as
-     * defined in an implementation or sub-interface, using a <code>key</code>
+     * defined in an implementation or sub-interface, using a {@code key}
      * that is {@link Object#equals equivalent} to the one used to borrow the
      * instance in the first place.
      * </p>
      * <p>
-     * The behaviour of this method when the pool has been exhausted is not
+     * The behavior of this method when the pool has been exhausted is not
      * strictly specified (although it may be specified by implementations).
      * </p>
      *
@@ -185,7 +185,7 @@ public interface KeyedObjectPool<K, V> extends Closeable {
 
     /**
      * Clears the specified pool, removing all pooled instances corresponding 
to
-     * the given <code>key</code> (optional operation).
+     * the given {@code key} (optional operation).
      *
      * @param key the key to clear
      *
@@ -221,12 +221,12 @@ public interface KeyedObjectPool<K, V> extends Closeable {
 
     /**
      * Returns the number of instances currently borrowed from but not yet
-     * returned to the pool corresponding to the given <code>key</code>.
+     * returned to the pool corresponding to the given {@code key}.
      * Returns a negative value if this information is not available.
      *
      * @param key the key to query
      * @return the number of instances currently borrowed from but not yet
-     * returned to the pool corresponding to the given <code>key</code>.
+     * returned to the pool corresponding to the given {@code key}.
      */
     int getNumActive(K key);
 
@@ -239,22 +239,22 @@ public interface KeyedObjectPool<K, V> extends Closeable {
 
     /**
      * Returns the number of instances corresponding to the given
-     * <code>key</code> currently idle in this pool. Returns a negative value 
if
+     * {@code key} currently idle in this pool. Returns a negative value if
      * this information is not available.
      *
      * @param key the key to query
      * @return the number of instances corresponding to the given
-     * <code>key</code> currently idle in this pool.
+     * {@code key} currently idle in this pool.
      */
     int getNumIdle(K key);
 
     /**
      * Invalidates an object from the pool.
      * <p>
-     * By contract, <code>obj</code> <strong>must</strong> have been obtained
+     * By contract, {@code obj} <strong>must</strong> have been obtained
      * using {@link #borrowObject borrowObject} or a related method as defined
-     * in an implementation or sub-interface using a <code>key</code> that is
-     * equivalent to the one used to borrow the <code>Object</code> in the 
first
+     * in an implementation or sub-interface using a {@code key} that is
+     * equivalent to the one used to borrow the {@code Object} in the first
      * place.
      * </p>
      * <p>
@@ -270,10 +270,10 @@ public interface KeyedObjectPool<K, V> extends Closeable {
     void invalidateObject(K key, V obj) throws Exception;
 
     /**
-     * Return an instance to the pool. By contract, <code>obj</code>
+     * Return an instance to the pool. By contract, {@code obj}
      * <strong>must</strong> have been obtained using
      * {@link #borrowObject borrowObject} or a related method as defined in an
-     * implementation or sub-interface using a <code>key</code> that is
+     * implementation or sub-interface using a {@code key} that is
      * equivalent to the one used to borrow the instance in the first place.
      *
      * @param key the key used to obtain the object
diff --git a/java/org/apache/tomcat/dbcp/pool2/KeyedPooledObjectFactory.java 
b/java/org/apache/tomcat/dbcp/pool2/KeyedPooledObjectFactory.java
index bdf138c..5bf8b11 100644
--- a/java/org/apache/tomcat/dbcp/pool2/KeyedPooledObjectFactory.java
+++ b/java/org/apache/tomcat/dbcp/pool2/KeyedPooledObjectFactory.java
@@ -36,7 +36,7 @@ package org.apache.tomcat.dbcp.pool2;
  *   {@link #validateObject} may be invoked on {@link #activateObject 
activated}
  *   instances to make sure they can be
  *   {@link KeyedObjectPool#borrowObject borrowed} from the pool.
- *   <code>validateObject</code> may also be used to test an
+ *   {@code validateObject} may also be used to test an
  *   instance being {@link KeyedObjectPool#returnObject returned} to the pool
  *   before it is {@link #passivateObject passivated}. It will only be invoked
  *   on an activated instance.
@@ -48,7 +48,7 @@ package org.apache.tomcat.dbcp.pool2;
  *  <li>
  *   {@link #destroyObject destroyObject}
  *   is invoked on every instance when it is being "dropped" from the
- *   pool (whether due to the response from <code>validateObject</code>,
+ *   pool (whether due to the response from {@code validateObject},
  *   or for reasons specific to the pool implementation.) There is no
  *   guarantee that the instance being destroyed will
  *   be considered active, passive or in a generally consistent state.
@@ -57,7 +57,7 @@ package org.apache.tomcat.dbcp.pool2;
  * {@link KeyedPooledObjectFactory} must be thread-safe. The only promise
  * an {@link KeyedObjectPool} makes is that the same instance of an object will
  * not be passed to more than one method of a
- * <code>KeyedPoolableObjectFactory</code> at a time.
+ * {@code KeyedPoolableObjectFactory} at a time.
  * <p>
  * While clients of a {@link KeyedObjectPool} borrow and return instances of
  * the underlying value type V, the factory methods act on instances of
@@ -94,7 +94,7 @@ public interface KeyedPooledObjectFactory<K, V> {
      * Destroy an instance no longer needed by the pool.
      * <p>
      * It is important for implementations of this method to be aware that 
there
-     * is no guarantee about what state <code>obj</code> will be in and the
+     * is no guarantee about what state {@code obj} will be in and the
      * implementation should be prepared to handle unexpected errors.
      * </p>
      * <p>
@@ -119,8 +119,8 @@ public interface KeyedPooledObjectFactory<K, V> {
      * @param key the key used when selecting the object
      * @param p a {@code PooledObject} wrapping the instance to be validated
      *
-     * @return <code>false</code> if <code>obj</code> is not valid and should
-     *         be dropped from the pool, <code>true</code> otherwise.
+     * @return {@code false} if {@code obj} is not valid and should
+     *         be dropped from the pool, {@code true} otherwise.
      */
     boolean validateObject(K key, PooledObject<V> p);
 
@@ -130,7 +130,7 @@ public interface KeyedPooledObjectFactory<K, V> {
      * @param key the key used when selecting the object
      * @param p a {@code PooledObject} wrapping the instance to be activated
      *
-     * @throws Exception if there is a problem activating <code>obj</code>,
+     * @throws Exception if there is a problem activating {@code obj},
      *    this exception may be swallowed by the pool.
      *
      * @see #destroyObject
@@ -143,7 +143,7 @@ public interface KeyedPooledObjectFactory<K, V> {
      * @param key the key used when selecting the object
      * @param p a {@code PooledObject} wrapping the instance to be passivated
      *
-     * @throws Exception if there is a problem passivating <code>obj</code>,
+     * @throws Exception if there is a problem passivating {@code obj},
      *    this exception may be swallowed by the pool.
      *
      * @see #destroyObject
diff --git a/java/org/apache/tomcat/dbcp/pool2/ObjectPool.java 
b/java/org/apache/tomcat/dbcp/pool2/ObjectPool.java
index ed94d93..d371317 100644
--- a/java/org/apache/tomcat/dbcp/pool2/ObjectPool.java
+++ b/java/org/apache/tomcat/dbcp/pool2/ObjectPool.java
@@ -62,7 +62,7 @@ public interface ObjectPool<T> extends Closeable {
     /**
      * Creates an object using the {@link PooledObjectFactory factory} or other
      * implementation dependent mechanism, passivate it, and then place it in
-     * the idle object pool. <code>addObject</code> is useful for "pre-loading"
+     * the idle object pool. {@code addObject} is useful for "pre-loading"
      * a pool with idle objects. (Optional operation).
      *
      * @throws Exception
@@ -76,7 +76,7 @@ public interface ObjectPool<T> extends Closeable {
             UnsupportedOperationException;
 
     /**
-     * Calls {@link ObjectPool#addObject()} <code>count</code>
+     * Calls {@link ObjectPool#addObject()} {@code count}
      * number of times.
      *
      * @param count
@@ -106,7 +106,7 @@ public interface ObjectPool<T> extends Closeable {
      * method as defined in an implementation or sub-interface.
      * </p>
      * <p>
-     * The behaviour of this method when the pool has been exhausted
+     * The behavior of this method when the pool has been exhausted
      * is not strictly specified (although it may be specified by
      * implementations).
      * </p>
@@ -169,7 +169,7 @@ public interface ObjectPool<T> extends Closeable {
     /**
      * Invalidates an object from the pool.
      * <p>
-     * By contract, <code>obj</code> <strong>must</strong> have been obtained
+     * By contract, {@code obj} <strong>must</strong> have been obtained
      * using {@link #borrowObject} or a related method as defined in an
      * implementation or sub-interface.
      * </p>
@@ -185,7 +185,7 @@ public interface ObjectPool<T> extends Closeable {
     void invalidateObject(T obj) throws Exception;
 
     /**
-     * Returns an instance to the pool. By contract, <code>obj</code>
+     * Returns an instance to the pool. By contract, {@code obj}
      * <strong>must</strong> have been obtained using {@link #borrowObject()} 
or
      * a related method as defined in an implementation or sub-interface.
      *
diff --git a/java/org/apache/tomcat/dbcp/pool2/PoolUtils.java 
b/java/org/apache/tomcat/dbcp/pool2/PoolUtils.java
index 453444d..28e9531 100644
--- a/java/org/apache/tomcat/dbcp/pool2/PoolUtils.java
+++ b/java/org/apache/tomcat/dbcp/pool2/PoolUtils.java
@@ -99,9 +99,9 @@ public final class PoolUtils {
      * @return the {@link TimerTask} that will periodically check the pools 
idle
      *         object count.
      * @throws IllegalArgumentException
-     *             when <code>pool</code> is <code>null</code> or when
-     *             <code>minIdle</code> is negative or when <code>period</code>
-     *             isn't valid for {@link Timer#schedule(TimerTask, long, 
long)}
+     *             when {@code pool} is {@code null} or when {@code minIdle} is
+     *             negative or when {@code period} isn't valid for
+     *             {@link Timer#schedule(TimerTask, long, long)}
      */
     public static <T> TimerTask checkMinIdle(final ObjectPool<T> pool,
             final int minIdle, final long period)
@@ -138,10 +138,9 @@ public final class PoolUtils {
      * @return the {@link TimerTask} that will periodically check the pools 
idle
      *         object count.
      * @throws IllegalArgumentException
-     *             when <code>keyedPool</code>, <code>key</code> is
-     *             <code>null</code> or when <code>minIdle</code> is negative 
or
-     *             when <code>period</code> isn't valid for
-     *             {@link Timer#schedule(TimerTask, long, long)}.
+     *             when {@code keyedPool}, {@code key} is {@code null} or
+     *             when {@code minIdle} is negative or when {@code period} 
isn't
+     *             valid for {@link Timer#schedule(TimerTask, long, long)}.
      */
     public static <K, V> TimerTask checkMinIdle(
             final KeyedObjectPool<K, V> keyedPool, final K key,
@@ -164,8 +163,8 @@ public final class PoolUtils {
 
     /**
      * Periodically check the idle object count for each key in the
-     * <code>Collection</code> <code>keys</code> in the keyedPool. At most one
-     * idle object will be added per period.
+     * {@code Collection keys} in the keyedPool. At most one idle object will 
be
+     * added per period.
      *
      * @param keyedPool
      *            the keyedPool to check periodically.
@@ -182,11 +181,10 @@ public final class PoolUtils {
      * @return a {@link Map} of key and {@link TimerTask} pairs that will
      *         periodically check the pools idle object count.
      * @throws IllegalArgumentException
-     *             when <code>keyedPool</code>, <code>keys</code>, or any of 
the
-     *             values in the collection is <code>null</code> or when
-     *             <code>minIdle</code> is negative or when <code>period</code>
-     *             isn't valid for {@link Timer#schedule(TimerTask, long, 
long)}
-     *             .
+     *             when {@code keyedPool}, {@code keys}, or any of the values 
in
+     *             the collection is {@code null} or when {@code minIdle} is
+     *             negative or when {@code period} isn't valid for
+     *             {@link Timer#schedule(TimerTask, long, long)}.
      * @see #checkMinIdle(KeyedObjectPool, Object, int, long)
      */
     public static <K, V> Map<K, TimerTask> checkMinIdle(
@@ -205,8 +203,8 @@ public final class PoolUtils {
     }
 
     /**
-     * Calls {@link ObjectPool#addObject()} on <code>pool</code> 
<code>count</code>
-     * number of times.
+     * Calls {@link ObjectPool#addObject()} on {@code pool} {@code count} 
number
+     * of times.
      *
      * @param pool
      *            the pool to prefill.
@@ -216,7 +214,7 @@ public final class PoolUtils {
      * @throws Exception
      *             when {@link ObjectPool#addObject()} fails.
      * @throws IllegalArgumentException
-     *             when <code>pool</code> is <code>null</code>.
+     *             when {@code pool} is {@code null}.
      * @deprecated Use {@link ObjectPool#addObjects(int)}.
      */
     @Deprecated
@@ -229,22 +227,21 @@ public final class PoolUtils {
     }
 
     /**
-     * Calls {@link KeyedObjectPool#addObject(Object)} on 
<code>keyedPool</code> with
-     * <code>key</code> <code>count</code> number of times.
+     * Calls {@link KeyedObjectPool#addObject(Object)} on {@code keyedPool} 
with
+     * {@code key} {@code count} number of times.
      *
      * @param keyedPool
      *            the keyedPool to prefill.
      * @param key
      *            the key to add objects for.
      * @param count
-     *            the number of idle objects to add for <code>key</code>.
+     *            the number of idle objects to add for {@code key}.
      * @param <K> the type of the pool key
      * @param <V> the type of pool entries
      * @throws Exception
      *             when {@link KeyedObjectPool#addObject(Object)} fails.
      * @throws IllegalArgumentException
-     *             when <code>keyedPool</code> or <code>key</code> is
-     *             <code>null</code>.
+     *             when {@code keyedPool} or {@code key} is {@code null}.
      * @deprecated Use {@link KeyedObjectPool#addObjects(Object, int)}.
      */
     @Deprecated
@@ -258,24 +255,24 @@ public final class PoolUtils {
     }
 
     /**
-     * Calls {@link KeyedObjectPool#addObject(Object)} on 
<code>keyedPool</code> with each
-     * key in <code>keys</code> for <code>count</code> number of times. This 
has
+     * Calls {@link KeyedObjectPool#addObject(Object)} on {@code keyedPool} 
with
+     * each key in {@code keys} for {@code count} number of times. This has
      * the same effect as calling {@link #prefill(KeyedObjectPool, Object, 
int)}
-     * for each key in the <code>keys</code> collection.
+     * for each key in the {@code keys} collection.
      *
      * @param keyedPool
      *            the keyedPool to prefill.
      * @param keys
      *            {@link Collection} of keys to add objects for.
      * @param count
-     *            the number of idle objects to add for each <code>key</code>.
+     *            the number of idle objects to add for each {@code key}.
      * @param <K> the type of the pool key
      * @param <V> the type of pool entries
      * @throws Exception
      *             when {@link KeyedObjectPool#addObject(Object)} fails.
      * @throws IllegalArgumentException
-     *             when <code>keyedPool</code>, <code>keys</code>, or any value
-     *             in <code>keys</code> is <code>null</code>.
+     *             when {@code keyedPool}, {@code keys}, or any value in
+     *             {@code keys} is {@code null}.
      * @see #prefill(KeyedObjectPool, Object, int)
      * @deprecated Use {@link KeyedObjectPool#addObjects(Collection, int)}.
      */
@@ -304,6 +301,8 @@ public final class PoolUtils {
      * @param pool
      *            the ObjectPool to be "wrapped" in a synchronized ObjectPool.
      * @param <T> the type of objects in the pool
+     * @throws IllegalArgumentException
+     *             when {@code pool} is {@code null}.
      * @return a synchronized view of the specified ObjectPool.
      */
     public static <T> ObjectPool<T> synchronizedPool(final ObjectPool<T> pool) 
{
@@ -399,6 +398,8 @@ public final class PoolUtils {
      *            the ObjectPool to be decorated so it shrinks its idle count
      *            when possible.
      * @param <T> the type of objects in the pool
+     * @throws IllegalArgumentException
+     *             when {@code pool} is {@code null}.
      * @return a pool that adaptively decreases its size when idle objects are
      *         no longer needed.
      * @see #erodingPool(ObjectPool, float)
@@ -429,6 +430,9 @@ public final class PoolUtils {
      *            shrinks more aggressively. If 1 &lt; factor then the pool
      *            shrinks less aggressively.
      * @param <T> the type of objects in the pool
+     * @throws IllegalArgumentException
+     *             when {@code pool} is {@code null} or when {@code factor} is
+     *             not positive.
      * @return a pool that adaptively decreases its size when idle objects are
      *         no longer needed.
      * @see #erodingPool(ObjectPool)
@@ -456,6 +460,8 @@ public final class PoolUtils {
      *            count when possible.
      * @param <K> the type of the pool key
      * @param <V> the type of pool entries
+     * @throws IllegalArgumentException
+     *             when {@code keyedPool} is {@code null}.
      * @return a pool that adaptively decreases its size when idle objects are
      *         no longer needed.
      * @see #erodingPool(KeyedObjectPool, float)
@@ -489,6 +495,9 @@ public final class PoolUtils {
      *            shrinks less aggressively.
      * @param <K> the type of the pool key
      * @param <V> the type of pool entries
+     * @throws IllegalArgumentException
+     *             when {@code keyedPool} is {@code null} or when {@code 
factor}
+     *             is not positive.
      * @return a pool that adaptively decreases its size when idle objects are
      *         no longer needed.
      * @see #erodingPool(KeyedObjectPool, float, boolean)
@@ -529,6 +538,9 @@ public final class PoolUtils {
      *            when true, each key is treated independently.
      * @param <K> the type of the pool key
      * @param <V> the type of pool entries
+     * @throws IllegalArgumentException
+     *             when {@code keyedPool} is {@code null} or when {@code 
factor}
+     *             is not positive.
      * @return a pool that adaptively decreases its size when idle objects are
      *         no longer needed.
      * @see #erodingPool(KeyedObjectPool)
@@ -550,7 +562,7 @@ public final class PoolUtils {
     }
 
     /**
-     * Gets the <code>Timer</code> for checking keyedPool's idle count.
+     * Gets the {@code Timer} for checking keyedPool's idle count.
      *
      * @return the {@link Timer} for checking keyedPool's idle count.
      */
diff --git a/java/org/apache/tomcat/dbcp/pool2/PooledObject.java 
b/java/org/apache/tomcat/dbcp/pool2/PooledObject.java
index 601c6c5..8901531 100644
--- a/java/org/apache/tomcat/dbcp/pool2/PooledObject.java
+++ b/java/org/apache/tomcat/dbcp/pool2/PooledObject.java
@@ -134,9 +134,9 @@ public interface PooledObject<T> extends 
Comparable<PooledObject<T>> {
      * Attempts to place the pooled object in the
      * {@link PooledObjectState#EVICTION} state.
      *
-     * @return <code>true</code> if the object was placed in the
+     * @return {@code true} if the object was placed in the
      *         {@link PooledObjectState#EVICTION} state otherwise
-     *         <code>false</code>
+     *         {@code false}
      */
     boolean startEvictionTest();
 
diff --git a/java/org/apache/tomcat/dbcp/pool2/PooledObjectFactory.java 
b/java/org/apache/tomcat/dbcp/pool2/PooledObjectFactory.java
index 5259bdf..4973a1c 100644
--- a/java/org/apache/tomcat/dbcp/pool2/PooledObjectFactory.java
+++ b/java/org/apache/tomcat/dbcp/pool2/PooledObjectFactory.java
@@ -54,7 +54,7 @@ package org.apache.tomcat.dbcp.pool2;
  * </ol>
  * {@link PooledObjectFactory} must be thread-safe. The only promise
  * an {@link ObjectPool} makes is that the same instance of an object will not
- * be passed to more than one method of a <code>PoolableObjectFactory</code>
+ * be passed to more than one method of a {@code PoolableObjectFactory}
  * at a time.
  * <p>
  * While clients of a {@link KeyedObjectPool} borrow and return instances of
@@ -87,7 +87,7 @@ public interface PooledObjectFactory<T> {
    * Destroys an instance no longer needed by the pool.
    * <p>
    * It is important for implementations of this method to be aware that there
-   * is no guarantee about what state <code>obj</code> will be in and the
+   * is no guarantee about what state {@code obj} will be in and the
    * implementation should be prepared to handle unexpected errors.
    * </p>
    * <p>
@@ -110,8 +110,8 @@ public interface PooledObjectFactory<T> {
    *
    * @param p a {@code PooledObject} wrapping the instance to be validated
    *
-   * @return <code>false</code> if <code>obj</code> is not valid and should
-   *         be dropped from the pool, <code>true</code> otherwise.
+   * @return {@code false} if {@code obj} is not valid and should
+   *         be dropped from the pool, {@code true} otherwise.
    */
   boolean validateObject(PooledObject<T> p);
 
@@ -120,7 +120,7 @@ public interface PooledObjectFactory<T> {
    *
    * @param p a {@code PooledObject} wrapping the instance to be activated
    *
-   * @throws Exception if there is a problem activating <code>obj</code>,
+   * @throws Exception if there is a problem activating {@code obj},
    *    this exception may be swallowed by the pool.
    *
    * @see #destroyObject
@@ -132,7 +132,7 @@ public interface PooledObjectFactory<T> {
    *
    * @param p a {@code PooledObject} wrapping the instance to be passivated
    *
-   * @throws Exception if there is a problem passivating <code>obj</code>,
+   * @throws Exception if there is a problem passivating {@code obj},
    *    this exception may be swallowed by the pool.
    *
    * @see #destroyObject
diff --git a/java/org/apache/tomcat/dbcp/pool2/impl/AbandonedConfig.java 
b/java/org/apache/tomcat/dbcp/pool2/impl/AbandonedConfig.java
index 31eeb32..fc6b43d 100644
--- a/java/org/apache/tomcat/dbcp/pool2/impl/AbandonedConfig.java
+++ b/java/org/apache/tomcat/dbcp/pool2/impl/AbandonedConfig.java
@@ -17,7 +17,9 @@
 
 package org.apache.tomcat.dbcp.pool2.impl;
 
+import java.io.OutputStreamWriter;
 import java.io.PrintWriter;
+import java.nio.charset.Charset;
 
 /**
  * Configuration settings for abandoned object removal.
@@ -39,7 +41,7 @@ public class AbandonedConfig {
      *
      * <p>If set to true, abandoned objects are removed by borrowObject if
      * there are fewer than 2 idle objects available in the pool and
-     * <code>getNumActive() &gt; getMaxTotal() - 3</code></p>
+     * {@code getNumActive() &gt; getMaxTotal() - 3}</p>
      *
      * @return true if abandoned objects are to be removed by borrowObject
      */
@@ -208,7 +210,7 @@ public class AbandonedConfig {
      * PrintWriter to use to log information on abandoned objects.
      * Use of default system encoding is deliberate.
      */
-    private PrintWriter logWriter = new PrintWriter(System.out);
+    private PrintWriter logWriter = new PrintWriter(new 
OutputStreamWriter(System.out, Charset.defaultCharset()));
 
     /**
      * Returns the log writer being used by this configuration to log
@@ -246,7 +248,7 @@ public class AbandonedConfig {
      * stack trace every time a method is called on a pooled object and retain
      * the most recent stack trace to aid debugging of abandoned objects?
      *
-     * @return <code>true</code> if usage tracking is enabled
+     * @return {@code true} if usage tracking is enabled
      */
     public boolean getUseUsageTracking() {
         return useUsageTracking;
@@ -260,7 +262,7 @@ public class AbandonedConfig {
      * object and retain the most recent stack trace to aid debugging of
      * abandoned objects.
      *
-     * @param   useUsageTracking    A value of <code>true</code> will enable
+     * @param   useUsageTracking    A value of {@code true} will enable
      *                              the recording of a stack trace on every use
      *                              of a pooled object
      */
diff --git a/java/org/apache/tomcat/dbcp/pool2/impl/BaseGenericObjectPool.java 
b/java/org/apache/tomcat/dbcp/pool2/impl/BaseGenericObjectPool.java
index e37d42d..3583731 100644
--- a/java/org/apache/tomcat/dbcp/pool2/impl/BaseGenericObjectPool.java
+++ b/java/org/apache/tomcat/dbcp/pool2/impl/BaseGenericObjectPool.java
@@ -189,11 +189,11 @@ public abstract class BaseGenericObjectPool<T> extends 
BaseObject {
     }
 
     /**
-     * Returns whether to block when the <code>borrowObject()</code> method is
+     * Returns whether to block when the {@code borrowObject()} method is
      * invoked when the pool is exhausted (the maximum number of "active"
      * objects has been reached).
      *
-     * @return <code>true</code> if <code>borrowObject()</code> should block
+     * @return {@code true} if {@code borrowObject()} should block
      *         when the pool is exhausted
      *
      * @see #setBlockWhenExhausted
@@ -203,12 +203,12 @@ public abstract class BaseGenericObjectPool<T> extends 
BaseObject {
     }
 
     /**
-     * Sets whether to block when the <code>borrowObject()</code> method is
+     * Sets whether to block when the {@code borrowObject()} method is
      * invoked when the pool is exhausted (the maximum number of "active"
      * objects has been reached).
      *
-     * @param blockWhenExhausted    <code>true</code> if
-     *                              <code>borrowObject()</code> should block
+     * @param blockWhenExhausted    {@code true} if
+     *                              {@code borrowObject()} should block
      *                              when the pool is exhausted
      *
      * @see #getBlockWhenExhausted
@@ -217,37 +217,42 @@ public abstract class BaseGenericObjectPool<T> extends 
BaseObject {
         this.blockWhenExhausted = blockWhenExhausted;
     }
 
-    protected void setConfig(final BaseObjectPoolConfig<T> conf) {
-        setLifo(conf.getLifo());
-        setMaxWaitMillis(conf.getMaxWaitMillis());
-        setBlockWhenExhausted(conf.getBlockWhenExhausted());
-        setTestOnCreate(conf.getTestOnCreate());
-        setTestOnBorrow(conf.getTestOnBorrow());
-        setTestOnReturn(conf.getTestOnReturn());
-        setTestWhileIdle(conf.getTestWhileIdle());
-        setNumTestsPerEvictionRun(conf.getNumTestsPerEvictionRun());
-        setMinEvictableIdleTimeMillis(conf.getMinEvictableIdleTimeMillis());
-        
setTimeBetweenEvictionRunsMillis(conf.getTimeBetweenEvictionRunsMillis());
-        
setSoftMinEvictableIdleTimeMillis(conf.getSoftMinEvictableIdleTimeMillis());
-        final EvictionPolicy<T> policy = conf.getEvictionPolicy();
+    /**
+     * Initializes the receiver with the given configuration.
+     *
+     * @param config Initialization source.
+     */
+    protected void setConfig(final BaseObjectPoolConfig<T> config) {
+        setLifo(config.getLifo());
+        setMaxWaitMillis(config.getMaxWaitMillis());
+        setBlockWhenExhausted(config.getBlockWhenExhausted());
+        setTestOnCreate(config.getTestOnCreate());
+        setTestOnBorrow(config.getTestOnBorrow());
+        setTestOnReturn(config.getTestOnReturn());
+        setTestWhileIdle(config.getTestWhileIdle());
+        setNumTestsPerEvictionRun(config.getNumTestsPerEvictionRun());
+        setMinEvictableIdleTimeMillis(config.getMinEvictableIdleTimeMillis());
+        
setTimeBetweenEvictionRunsMillis(config.getTimeBetweenEvictionRunsMillis());
+        
setSoftMinEvictableIdleTimeMillis(config.getSoftMinEvictableIdleTimeMillis());
+        final EvictionPolicy<T> policy = config.getEvictionPolicy();
         if (policy == null) {
             // Use the class name (pre-2.6.0 compatible)
-            setEvictionPolicyClassName(conf.getEvictionPolicyClassName());
+            setEvictionPolicyClassName(config.getEvictionPolicyClassName());
         } else {
             // Otherwise, use the class (2.6.0 feature)
             setEvictionPolicy(policy);
         }
-        
setEvictorShutdownTimeoutMillis(conf.getEvictorShutdownTimeoutMillis());
+        
setEvictorShutdownTimeoutMillis(config.getEvictorShutdownTimeoutMillis());
     }
 
     /**
      * Returns the maximum amount of time (in milliseconds) the
-     * <code>borrowObject()</code> method should block before throwing an
+     * {@code borrowObject()} method should block before throwing an
      * exception when the pool is exhausted and
      * {@link #getBlockWhenExhausted} is true. When less than 0, the
-     * <code>borrowObject()</code> method may block indefinitely.
+     * {@code borrowObject()} method may block indefinitely.
      *
-     * @return the maximum number of milliseconds <code>borrowObject()</code>
+     * @return the maximum number of milliseconds {@code borrowObject()}
      *         will block.
      *
      * @see #setMaxWaitMillis
@@ -259,13 +264,13 @@ public abstract class BaseGenericObjectPool<T> extends 
BaseObject {
 
     /**
      * Sets the maximum amount of time (in milliseconds) the
-     * <code>borrowObject()</code> method should block before throwing an
+     * {@code borrowObject()} method should block before throwing an
      * exception when the pool is exhausted and
      * {@link #getBlockWhenExhausted} is true. When less than 0, the
-     * <code>borrowObject()</code> method may block indefinitely.
+     * {@code borrowObject()} method may block indefinitely.
      *
      * @param maxWaitMillis the maximum number of milliseconds
-     *                      <code>borrowObject()</code> will block or negative
+     *                      {@code borrowObject()} will block or negative
      *                      for indefinitely.
      *
      * @see #getMaxWaitMillis
@@ -276,14 +281,14 @@ public abstract class BaseGenericObjectPool<T> extends 
BaseObject {
     }
 
     /**
-     * Returns whether the pool has LIFO (last in, first out) behaviour with
+     * Returns whether the pool has LIFO (last in, first out) behavior with
      * respect to idle objects - always returning the most recently used object
      * from the pool, or as a FIFO (first in, first out) queue, where the pool
      * always returns the oldest object in the idle object pool.
      *
-     * @return <code>true</code> if the pool is configured with LIFO behaviour
-     *         or <code>false</code> if the pool is configured with FIFO
-     *         behaviour
+     * @return {@code true} if the pool is configured with LIFO behavior
+     *         or {@code false} if the pool is configured with FIFO
+     *         behavior
      *
      * @see #setLifo
      */
@@ -295,7 +300,7 @@ public abstract class BaseGenericObjectPool<T> extends 
BaseObject {
      * Returns whether or not the pool serves threads waiting to borrow 
objects fairly.
      * True means that waiting threads are served as if waiting in a FIFO 
queue.
      *
-     * @return <code>true</code> if waiting threads are to be served
+     * @return {@code true} if waiting threads are to be served
      *             by the pool in arrival order
      */
     public final boolean getFairness() {
@@ -303,14 +308,14 @@ public abstract class BaseGenericObjectPool<T> extends 
BaseObject {
     }
 
     /**
-     * Sets whether the pool has LIFO (last in, first out) behaviour with
+     * Sets whether the pool has LIFO (last in, first out) behavior with
      * respect to idle objects - always returning the most recently used object
      * from the pool, or as a FIFO (first in, first out) queue, where the pool
      * always returns the oldest object in the idle object pool.
      *
-     * @param lifo  <code>true</code> if the pool is to be configured with LIFO
-     *              behaviour or <code>false</code> if the pool is to be
-     *              configured with FIFO behaviour
+     * @param lifo  {@code true} if the pool is to be configured with LIFO
+     *              behavior or {@code false} if the pool is to be
+     *              configured with FIFO behavior
      *
      * @see #getLifo()
      */
@@ -320,13 +325,13 @@ public abstract class BaseGenericObjectPool<T> extends 
BaseObject {
 
     /**
      * Returns whether objects created for the pool will be validated before
-     * being returned from the <code>borrowObject()</code> method. Validation 
is
-     * performed by the <code>validateObject()</code> method of the factory
+     * being returned from the {@code borrowObject()} method. Validation is
+     * performed by the {@code validateObject()} method of the factory
      * associated with the pool. If the object fails to validate, then
-     * <code>borrowObject()</code> will fail.
+     * {@code borrowObject()} will fail.
      *
-     * @return <code>true</code> if newly created objects are validated before
-     *         being returned from the <code>borrowObject()</code> method
+     * @return {@code true} if newly created objects are validated before
+     *         being returned from the {@code borrowObject()} method
      *
      * @see #setTestOnCreate
      *
@@ -338,14 +343,14 @@ public abstract class BaseGenericObjectPool<T> extends 
BaseObject {
 
     /**
      * Sets whether objects created for the pool will be validated before
-     * being returned from the <code>borrowObject()</code> method. Validation 
is
-     * performed by the <code>validateObject()</code> method of the factory
+     * being returned from the {@code borrowObject()} method. Validation is
+     * performed by the {@code validateObject()} method of the factory
      * associated with the pool. If the object fails to validate, then
-     * <code>borrowObject()</code> will fail.
+     * {@code borrowObject()} will fail.
      *
-     * @param testOnCreate  <code>true</code> if newly created objects should 
be
+     * @param testOnCreate  {@code true} if newly created objects should be
      *                      validated before being returned from the
-     *                      <code>borrowObject()</code> method
+     *                      {@code borrowObject()} method
      *
      * @see #getTestOnCreate
      *
@@ -357,14 +362,14 @@ public abstract class BaseGenericObjectPool<T> extends 
BaseObject {
 
     /**
      * Returns whether objects borrowed from the pool will be validated before
-     * being returned from the <code>borrowObject()</code> method. Validation 
is
-     * performed by the <code>validateObject()</code> method of the factory
+     * being returned from the {@code borrowObject()} method. Validation is
+     * performed by the {@code validateObject()} method of the factory
      * associated with the pool. If the object fails to validate, it will be
      * removed from the pool and destroyed, and a new attempt will be made to
      * borrow an object from the pool.
      *
-     * @return <code>true</code> if objects are validated before being returned
-     *         from the <code>borrowObject()</code> method
+     * @return {@code true} if objects are validated before being returned
+     *         from the {@code borrowObject()} method
      *
      * @see #setTestOnBorrow
      */
@@ -374,15 +379,15 @@ public abstract class BaseGenericObjectPool<T> extends 
BaseObject {
 
     /**
      * Sets whether objects borrowed from the pool will be validated before
-     * being returned from the <code>borrowObject()</code> method. Validation 
is
-     * performed by the <code>validateObject()</code> method of the factory
+     * being returned from the {@code borrowObject()} method. Validation is
+     * performed by the {@code validateObject()} method of the factory
      * associated with the pool. If the object fails to validate, it will be
      * removed from the pool and destroyed, and a new attempt will be made to
      * borrow an object from the pool.
      *
-     * @param testOnBorrow  <code>true</code> if objects should be validated
+     * @param testOnBorrow  {@code true} if objects should be validated
      *                      before being returned from the
-     *                      <code>borrowObject()</code> method
+     *                      {@code borrowObject()} method
      *
      * @see #getTestOnBorrow
      */
@@ -392,13 +397,13 @@ public abstract class BaseGenericObjectPool<T> extends 
BaseObject {
 
     /**
      * Returns whether objects borrowed from the pool will be validated when
-     * they are returned to the pool via the <code>returnObject()</code> 
method.
-     * Validation is performed by the <code>validateObject()</code> method of
+     * they are returned to the pool via the {@code returnObject()} method.
+     * Validation is performed by the {@code validateObject()} method of
      * the factory associated with the pool. Returning objects that fail 
validation
      * are destroyed rather then being returned the pool.
      *
-     * @return <code>true</code> if objects are validated on return to
-     *         the pool via the <code>returnObject()</code> method
+     * @return {@code true} if objects are validated on return to
+     *         the pool via the {@code returnObject()} method
      *
      * @see #setTestOnReturn
      */
@@ -408,14 +413,14 @@ public abstract class BaseGenericObjectPool<T> extends 
BaseObject {
 
     /**
      * Sets whether objects borrowed from the pool will be validated when
-     * they are returned to the pool via the <code>returnObject()</code> 
method.
-     * Validation is performed by the <code>validateObject()</code> method of
+     * they are returned to the pool via the {@code returnObject()} method.
+     * Validation is performed by the {@code validateObject()} method of
      * the factory associated with the pool. Returning objects that fail 
validation
      * are destroyed rather then being returned the pool.
      *
-     * @param testOnReturn <code>true</code> if objects are validated on
+     * @param testOnReturn {@code true} if objects are validated on
      *                     return to the pool via the
-     *                     <code>returnObject()</code> method
+     *                     {@code returnObject()} method
      *
      * @see #getTestOnReturn
      */
@@ -427,11 +432,11 @@ public abstract class BaseGenericObjectPool<T> extends 
BaseObject {
      * Returns whether objects sitting idle in the pool will be validated by 
the
      * idle object evictor (if any - see
      * {@link #setTimeBetweenEvictionRunsMillis(long)}). Validation is 
performed
-     * by the <code>validateObject()</code> method of the factory associated
+     * by the {@code validateObject()} method of the factory associated
      * with the pool. If the object fails to validate, it will be removed from
      * the pool and destroyed.
      *
-     * @return <code>true</code> if objects will be validated by the evictor
+     * @return {@code true} if objects will be validated by the evictor
      *
      * @see #setTestWhileIdle
      * @see #setTimeBetweenEvictionRunsMillis
@@ -444,14 +449,14 @@ public abstract class BaseGenericObjectPool<T> extends 
BaseObject {
      * Returns whether objects sitting idle in the pool will be validated by 
the
      * idle object evictor (if any - see
      * {@link #setTimeBetweenEvictionRunsMillis(long)}). Validation is 
performed
-     * by the <code>validateObject()</code> method of the factory associated
+     * by the {@code validateObject()} method of the factory associated
      * with the pool. If the object fails to validate, it will be removed from
      * the pool and destroyed.  Note that setting this property has no effect
      * unless the idle object evictor is enabled by setting
-     * <code>timeBetweenEvictionRunsMillis</code> to a positive value.
+     * {@code timeBetweenEvictionRunsMillis} to a positive value.
      *
      * @param testWhileIdle
-     *            <code>true</code> so objects will be validated by the evictor
+     *            {@code true} so objects will be validated by the evictor
      *
      * @see #getTestWhileIdle
      * @see #setTimeBetweenEvictionRunsMillis
@@ -498,7 +503,7 @@ public abstract class BaseGenericObjectPool<T> extends 
BaseObject {
      * number of idle instances in the pool. When negative, the number of tests
      * performed will be <code>ceil({@link #getNumIdle}/
      * abs({@link #getNumTestsPerEvictionRun}))</code> which means that when 
the
-     * value is <code>-n</code> roughly one nth of the idle objects will be
+     * value is {@code -n} roughly one nth of the idle objects will be
      * tested per run.
      *
      * @return max number of objects to examine during each evictor run
@@ -517,7 +522,7 @@ public abstract class BaseGenericObjectPool<T> extends 
BaseObject {
      * number of idle instances in the pool. When negative, the number of tests
      * performed will be <code>ceil({@link #getNumIdle}/
      * abs({@link #getNumTestsPerEvictionRun}))</code> which means that when 
the
-     * value is <code>-n</code> roughly one nth of the idle objects will be
+     * value is {@code -n} roughly one nth of the idle objects will be
      * tested per run.
      *
      * @param numTestsPerEvictionRun
@@ -568,7 +573,7 @@ public abstract class BaseGenericObjectPool<T> extends 
BaseObject {
      * Returns the minimum amount of time an object may sit idle in the pool
      * before it is eligible for eviction by the idle object evictor (if any -
      * see {@link #setTimeBetweenEvictionRunsMillis(long)}),
-     * with the extra condition that at least <code>minIdle</code> object
+     * with the extra condition that at least {@code minIdle} object
      * instances remain in the pool. This setting is overridden by
      * {@link #getMinEvictableIdleTimeMillis} (that is, if
      * {@link #getMinEvictableIdleTimeMillis} is positive, then
@@ -587,7 +592,7 @@ public abstract class BaseGenericObjectPool<T> extends 
BaseObject {
      * Sets the minimum amount of time an object may sit idle in the pool
      * before it is eligible for eviction by the idle object evictor (if any -
      * see {@link #setTimeBetweenEvictionRunsMillis(long)}),
-     * with the extra condition that at least <code>minIdle</code> object
+     * with the extra condition that at least {@code minIdle} object
      * instances remain in the pool. This setting is overridden by
      * {@link #getMinEvictableIdleTimeMillis} (that is, if
      * {@link #getMinEvictableIdleTimeMillis} is positive, then
@@ -653,16 +658,22 @@ public abstract class BaseGenericObjectPool<T> extends 
BaseObject {
                 setEvictionPolicy(evictionPolicyClassName, epClassLoader);
             }
         } catch (final ClassCastException e) {
-            throw new IllegalArgumentException("Class " + 
evictionPolicyClassName + " from class loaders ["
-                    + classLoader + ", " + epClassLoader + "] do not implement 
" + EVICTION_POLICY_TYPE_NAME);
-        } catch (final ClassNotFoundException | InstantiationException | 
IllegalAccessException
-                | InvocationTargetException | NoSuchMethodException e) {
-            final String exMessage = "Unable to create " + 
EVICTION_POLICY_TYPE_NAME + " instance of type "
-                    + evictionPolicyClassName;
+            throw new IllegalArgumentException("Class " + 
evictionPolicyClassName + " from class loaders [" +
+                    classLoader + ", " + epClassLoader + "] do not implement " 
+ EVICTION_POLICY_TYPE_NAME);
+        } catch (final ClassNotFoundException | InstantiationException | 
IllegalAccessException |
+                InvocationTargetException | NoSuchMethodException e) {
+            final String exMessage = "Unable to create " + 
EVICTION_POLICY_TYPE_NAME + " instance of type " +
+                    evictionPolicyClassName;
             throw new IllegalArgumentException(exMessage, e);
         }
     }
 
+    /**
+     * Sets the eviction policy.
+     *
+     * @param className Eviction policy class name.
+     * @param classLoader Load the class from this class loader.
+     */
     @SuppressWarnings("unchecked")
     private void setEvictionPolicy(final String className, final ClassLoader 
classLoader)
             throws ClassNotFoundException, InstantiationException, 
IllegalAccessException, InvocationTargetException, NoSuchMethodException {
@@ -721,18 +732,18 @@ public abstract class BaseGenericObjectPool<T> extends 
BaseObject {
 
     /**
      * Has this pool instance been closed.
-     * @return <code>true</code> when this pool has been closed.
+     * @return {@code true} when this pool has been closed.
      */
     public final boolean isClosed() {
         return closed;
     }
 
     /**
-     * <p>Perform <code>numTests</code> idle object eviction tests, evicting
+     * <p>Perform {@code numTests} idle object eviction tests, evicting
      * examined objects that meet the criteria for eviction. If
-     * <code>testWhileIdle</code> is true, examined objects are validated
+     * {@code testWhileIdle} is true, examined objects are validated
      * when visited (and removed if invalid); otherwise only objects that
-     * have been idle for more than <code>minEvicableIdleTimeMillis</code>
+     * have been idle for more than {@code minEvicableIdleTimeMillis}
      * are removed.</p>
      *
      * @throws Exception when there is a problem evicting idle objects.
@@ -772,12 +783,23 @@ public abstract class BaseGenericObjectPool<T> extends 
BaseObject {
      */
     final void startEvictor(final long delay) {
         synchronized (evictionLock) {
-            EvictionTimer.cancel(evictor, evictorShutdownTimeoutMillis, 
TimeUnit.MILLISECONDS);
-            evictor = null;
-            evictionIterator = null;
-            if (delay > 0) {
-                evictor = new Evictor();
-                EvictionTimer.schedule(evictor, delay, delay);
+            if (evictor == null) { // Starting evictor for the first time or 
after a cancel
+                if (delay > 0) {   // Starting new evictor
+                    evictor = new Evictor();
+                    EvictionTimer.schedule(evictor, delay, delay);
+                }
+            } else {  // Stop or restart of existing evictor
+                if (delay > 0) { // Restart
+                    synchronized (EvictionTimer.class) { // Ensure no cancel 
can happen between cancel / schedule calls
+                        EvictionTimer.cancel(evictor, 
evictorShutdownTimeoutMillis, TimeUnit.MILLISECONDS, true);
+                        evictor = null;
+                        evictionIterator = null;
+                        evictor = new Evictor();
+                        EvictionTimer.schedule(evictor, delay, delay);
+                    }
+                } else { // Stopping evictor
+                    EvictionTimer.cancel(evictor, 
evictorShutdownTimeoutMillis, TimeUnit.MILLISECONDS, false);
+                }
             }
         }
     }
@@ -800,7 +822,7 @@ public abstract class BaseGenericObjectPool<T> extends 
BaseObject {
 
     /**
      * Provides the name under which the pool has been registered with the
-     * platform MBean server or <code>null</code> if the pool has not been
+     * platform MBean server or {@code null} if the pool has not been
      * registered.
      * @return the JMX name
      */
@@ -868,7 +890,7 @@ public abstract class BaseGenericObjectPool<T> extends 
BaseObject {
 
     /**
      * The total number of objects destroyed by this pool as a result of 
failing
-     * validation during <code>borrowObject()</code> over the lifetime of the
+     * validation during {@code borrowObject()} over the lifetime of the
      * pool.
      * @return validation destroyed object count
      */
@@ -924,7 +946,7 @@ public abstract class BaseGenericObjectPool<T> extends 
BaseObject {
      * The listener used (if any) to receive notifications of exceptions
      * unavoidably swallowed by the pool.
      *
-     * @return The listener or <code>null</code> for no listener
+     * @return The listener or {@code null} for no listener
      */
     public final SwallowedExceptionListener getSwallowedExceptionListener() {
         return swallowedExceptionListener;
@@ -934,7 +956,7 @@ public abstract class BaseGenericObjectPool<T> extends 
BaseObject {
      * The listener used (if any) to receive notifications of exceptions
      * unavoidably swallowed by the pool.
      *
-     * @param swallowedExceptionListener    The listener or <code>null</code>
+     * @param swallowedExceptionListener    The listener or {@code null}
      *                                      for no listener
      */
     public final void setSwallowedExceptionListener(
@@ -1026,7 +1048,7 @@ public abstract class BaseGenericObjectPool<T> extends 
BaseObject {
     /**
      * Registers the pool with the platform MBean server.
      * The registered name will be
-     * <code>jmxNameBase + jmxNamePrefix + i</code> where i is the least
+     * {@code jmxNameBase + jmxNamePrefix + i} where i is the least
      * integer greater than or equal to 1 such that the name is not already
      * registered. Swallows MBeanRegistrationException, 
NotCompliantMBeanException
      * returning null.
@@ -1156,14 +1178,23 @@ public abstract class BaseGenericObjectPool<T> extends 
BaseObject {
         }
 
 
+        /**
+         * Sets the scheduled future.
+         *
+         * @param scheduledFuture the scheduled future.
+         */
         void setScheduledFuture(final ScheduledFuture<?> scheduledFuture) {
             this.scheduledFuture = scheduledFuture;
         }
 
 
+        /**
+         * Cancels the scheduled future.
+         */
         void cancel() {
             scheduledFuture.cancel(false);
         }
+
     }
 
     /**
diff --git a/java/org/apache/tomcat/dbcp/pool2/impl/BaseObjectPoolConfig.java 
b/java/org/apache/tomcat/dbcp/pool2/impl/BaseObjectPoolConfig.java
index 7814c6d..8e068f2 100644
--- a/java/org/apache/tomcat/dbcp/pool2/impl/BaseObjectPoolConfig.java
+++ b/java/org/apache/tomcat/dbcp/pool2/impl/BaseObjectPoolConfig.java
@@ -148,7 +148,7 @@ public abstract class BaseObjectPoolConfig<T> extends 
BaseObject implements Clon
 
     /**
      * The default value for the base name to use to name JMX enabled pools
-     * created with a configuration instance. The default is <code>null</code>
+     * created with a configuration instance. The default is {@code null}
      * which means the pool will provide the base name to use.
      * @see GenericObjectPool#getJmxName()
      * @see GenericKeyedObjectPool#getJmxName()
@@ -665,7 +665,7 @@ public abstract class BaseObjectPoolConfig<T> extends 
BaseObject implements Clon
     /**
      * Gets the value of the JMX name base that will be used as part of the
      * name assigned to JMX enabled pools created with this configuration
-     * instance. A value of <code>null</code> means that the pool will define
+     * instance. A value of {@code null} means that the pool will define
      * the JMX name base.
      *
      * @return  The current setting of {@code jmxNameBase} for this
@@ -678,7 +678,7 @@ public abstract class BaseObjectPoolConfig<T> extends 
BaseObject implements Clon
     /**
      * Sets the value of the JMX name base that will be used as part of the
      * name assigned to JMX enabled pools created with this configuration
-     * instance. A value of <code>null</code> means that the pool will define
+     * instance. A value of {@code null} means that the pool will define
      * the JMX name base.
      *
      * @param jmxNameBase The new setting of {@code jmxNameBase}
diff --git a/java/org/apache/tomcat/dbcp/pool2/impl/CallStackUtils.java 
b/java/org/apache/tomcat/dbcp/pool2/impl/CallStackUtils.java
index 71db0e1..a5644ad 100644
--- a/java/org/apache/tomcat/dbcp/pool2/impl/CallStackUtils.java
+++ b/java/org/apache/tomcat/dbcp/pool2/impl/CallStackUtils.java
@@ -72,9 +72,9 @@ public final class CallStackUtils {
     public static CallStack newCallStack(final String messageFormat,
                                          final boolean useTimestamp,
                                          final boolean requireFullStackTrace) {
-        return canCreateSecurityManager() && !requireFullStackTrace
-            ? new SecurityManagerCallStack(messageFormat, useTimestamp)
-            : new ThrowableCallStack(messageFormat, useTimestamp);
+        return canCreateSecurityManager() && !requireFullStackTrace ?
+            new SecurityManagerCallStack(messageFormat, useTimestamp) :
+            new ThrowableCallStack(messageFormat, useTimestamp);
     }
 
     /**
diff --git a/java/org/apache/tomcat/dbcp/pool2/impl/DefaultPooledObject.java 
b/java/org/apache/tomcat/dbcp/pool2/impl/DefaultPooledObject.java
index 471a7fa..1883041 100644
--- a/java/org/apache/tomcat/dbcp/pool2/impl/DefaultPooledObject.java
+++ b/java/org/apache/tomcat/dbcp/pool2/impl/DefaultPooledObject.java
@@ -206,9 +206,11 @@ public class DefaultPooledObject<T> implements 
PooledObject<T> {
 
     /**
      * Deallocates the object and sets it {@link PooledObjectState#IDLE IDLE}
-     * if it is currently {@link PooledObjectState#ALLOCATED ALLOCATED}.
+     * if it is currently {@link PooledObjectState#ALLOCATED ALLOCATED}
+     * or {@link PooledObjectState#RETURNING RETURNING}.
      *
      * @return {@code true} if the state was {@link 
PooledObjectState#ALLOCATED ALLOCATED}
+     *         or {@link PooledObjectState#RETURNING RETURNING}.
      */
     @Override
     public synchronized boolean deallocate() {
diff --git 
a/java/org/apache/tomcat/dbcp/pool2/impl/DefaultPooledObjectInfoMBean.java 
b/java/org/apache/tomcat/dbcp/pool2/impl/DefaultPooledObjectInfoMBean.java
index 27480e9..eac4a5c 100644
--- a/java/org/apache/tomcat/dbcp/pool2/impl/DefaultPooledObjectInfoMBean.java
+++ b/java/org/apache/tomcat/dbcp/pool2/impl/DefaultPooledObjectInfoMBean.java
@@ -42,7 +42,7 @@ public interface DefaultPooledObjectInfoMBean {
      * Obtain the time that pooled object was created.
      *
      * @return The creation time for the pooled object formatted as
-     *         <code>yyyy-MM-dd HH:mm:ss Z</code>
+     *         {@code yyyy-MM-dd HH:mm:ss Z}
      */
     String getCreateTimeFormatted();
 
@@ -58,7 +58,7 @@ public interface DefaultPooledObjectInfoMBean {
      * Obtain the time that pooled object was last borrowed.
      *
      * @return The last borrowed time for the pooled object formated as
-     *         <code>yyyy-MM-dd HH:mm:ss Z</code>
+     *         {@code yyyy-MM-dd HH:mm:ss Z}
      */
     String getLastBorrowTimeFormatted();
 
@@ -83,7 +83,7 @@ public interface DefaultPooledObjectInfoMBean {
      * Obtain the time that pooled object was last returned.
      *
      * @return The last returned time for the pooled object formated as
-     *         <code>yyyy-MM-dd HH:mm:ss Z</code>
+     *         {@code yyyy-MM-dd HH:mm:ss Z}
      */
     String getLastReturnTimeFormatted();
 
diff --git a/java/org/apache/tomcat/dbcp/pool2/impl/EvictionPolicy.java 
b/java/org/apache/tomcat/dbcp/pool2/impl/EvictionPolicy.java
index e97ffa5..f31f035 100644
--- a/java/org/apache/tomcat/dbcp/pool2/impl/EvictionPolicy.java
+++ b/java/org/apache/tomcat/dbcp/pool2/impl/EvictionPolicy.java
@@ -37,8 +37,8 @@ public interface EvictionPolicy<T> {
      * @param underTest The pooled object being tested for eviction
      * @param idleCount The current number of idle objects in the pool 
including
      *                      the object under test
-     * @return <code>true</code> if the object should be evicted, otherwise
-     *             <code>false</code>
+     * @return {@code true} if the object should be evicted, otherwise
+     *             {@code false}
      */
     boolean evict(EvictionConfig config, PooledObject<T> underTest, int 
idleCount);
 }
diff --git a/java/org/apache/tomcat/dbcp/pool2/impl/EvictionTimer.java 
b/java/org/apache/tomcat/dbcp/pool2/impl/EvictionTimer.java
index e1ef59a..31e93d9 100644
--- a/java/org/apache/tomcat/dbcp/pool2/impl/EvictionTimer.java
+++ b/java/org/apache/tomcat/dbcp/pool2/impl/EvictionTimer.java
@@ -16,13 +16,17 @@
  */
 package org.apache.tomcat.dbcp.pool2.impl;
 
+import java.lang.ref.WeakReference;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
+import java.util.HashMap;
+import java.util.Map.Entry;
 import java.util.concurrent.ScheduledFuture;
 import java.util.concurrent.ScheduledThreadPoolExecutor;
 import java.util.concurrent.ThreadFactory;
 import java.util.concurrent.TimeUnit;
 
+
 /**
  * Provides a shared idle object eviction timer for all pools.
  * <p>
@@ -46,6 +50,9 @@ class EvictionTimer {
     /** Executor instance */
     private static ScheduledThreadPoolExecutor executor; 
//@GuardedBy("EvictionTimer.class")
 
+    /** Keys are weak references to tasks, values are runners managed by 
executor. */
+    private static final HashMap<WeakReference<Runnable>, WeakRunner> taskMap 
= new HashMap<>(); // @GuardedBy("EvictionTimer.class")
+
     /** Prevents instantiation */
     private EvictionTimer() {
         // Hide the default constructor
@@ -62,10 +69,10 @@ class EvictionTimer {
         return builder.toString();
     }
 
-
     /**
-     * Adds the specified eviction task to the timer. Tasks that are added 
with a
-     * call to this method *must* call {@link 
#cancel(BaseGenericObjectPool.Evictor,long,TimeUnit)}
+     * Adds the specified eviction task to the timer. Tasks that are added with
+     * a call to this method *must* call {@link
+     * 
#cancel(org.apache.tomcat.dbcp.pool2.impl.BaseGenericObjectPool.Evictor, long, 
TimeUnit, boolean)}
      * to cancel the task to prevent memory and/or thread leaks in application
      * server environments.
      *
@@ -78,10 +85,14 @@ class EvictionTimer {
         if (null == executor) {
             executor = new ScheduledThreadPoolExecutor(1, new 
EvictorThreadFactory());
             executor.setRemoveOnCancelPolicy(true);
+            executor.scheduleAtFixedRate(new Reaper(), delay, period, 
TimeUnit.MILLISECONDS);
         }
+        final WeakReference<Runnable> ref = new WeakReference<>(task);
+        final WeakRunner runner = new WeakRunner(ref);
         final ScheduledFuture<?> scheduledFuture =
-                executor.scheduleWithFixedDelay(task, delay, period, 
TimeUnit.MILLISECONDS);
+                executor.scheduleWithFixedDelay(runner, delay, period, 
TimeUnit.MILLISECONDS);
         task.setScheduledFuture(scheduledFuture);
+        taskMap.put(ref, runner);
     }
 
     /**
@@ -92,26 +103,53 @@ class EvictionTimer {
      *                  long should this thread wait for the executor to
      *                  terminate?
      * @param unit      The units for the specified timeout.
+     * @param restarting The state of the evictor.
      */
     static synchronized void cancel(
-            final BaseGenericObjectPool<?>.Evictor evictor, final long 
timeout, final TimeUnit unit) {
+            final BaseGenericObjectPool<?>.Evictor evictor, final long 
timeout, final TimeUnit unit, final boolean restarting) {
         if (evictor != null) {
             evictor.cancel();
+            remove(evictor);
+        }
+        if (!restarting && executor != null) {
+            if (taskMap.isEmpty()) {
+                executor.shutdown();
+                try {
+                    executor.awaitTermination(timeout, unit);
+                } catch (final InterruptedException e) {
+                    // Swallow
+                    // Significant API changes would be required to propagate 
this
+                }
+                executor.setCorePoolSize(0);
+                executor = null;
+            }
         }
-        if (executor != null && executor.getQueue().isEmpty()) {
-            executor.shutdown();
-            try {
-                executor.awaitTermination(timeout, unit);
-            } catch (final InterruptedException e) {
-                // Swallow
-                // Significant API changes would be required to propagate this
+    }
+
+    /**
+     * Removes evictor from the task set and executor.
+     * Only called when holding the class lock.
+     *
+     * @param evictor Eviction task to remove
+     */
+    private static void remove(final BaseGenericObjectPool<?>.Evictor evictor) 
{
+        for (Entry<WeakReference<Runnable>, WeakRunner> entry : 
taskMap.entrySet()) {
+            if (entry.getKey().get() == evictor) {
+                executor.remove(entry.getValue());
+                taskMap.remove(entry.getKey());
+                break;
             }
-            executor.setCorePoolSize(0);
-            executor = null;
         }
     }
 
     /**
+     * @return the number of eviction tasks under management.
+     */
+    static synchronized int getNumTasks() {
+        return taskMap.size();
+    }
+
+    /**
      * Thread factory that creates a daemon thread, with the context class 
loader from this class.
      */
     private static class EvictorThreadFactory implements ThreadFactory {
@@ -128,4 +166,56 @@ class EvictionTimer {
             return thread;
         }
     }
+
+    /**
+     * Task that removes references to abandoned tasks and shuts
+     * down the executor if there are no live tasks left.
+     */
+    private static class Reaper implements Runnable {
+        @Override
+        public void run() {
+            synchronized (EvictionTimer.class) {
+                for (Entry<WeakReference<Runnable>, WeakRunner> entry : 
taskMap.entrySet()) {
+                    if (entry.getKey().get() == null) {
+                        executor.remove(entry.getValue());
+                        taskMap.remove(entry.getKey());
+                    }
+                }
+                if (taskMap.isEmpty() && executor != null) {
+                    executor.shutdown();
+                    executor.setCorePoolSize(0);
+                    executor = null;
+                }
+            }
+        }
+    }
+
+    /**
+     * Runnable that runs the referent of a weak reference. When the referent 
is no
+     * no longer reachable, run is no-op.
+     */
+    private static class WeakRunner implements Runnable {
+
+        private final WeakReference<Runnable> ref;
+
+        /**
+         * Constructs a new instance to track the given reference.
+         *
+         * @param ref the reference to track.
+         */
+        private WeakRunner(WeakReference<Runnable> ref) {
+           this.ref = ref;
+        }
+
+        @Override
+        public void run() {
+            final Runnable task = ref.get();
+            if (task != null) {
+                task.run();
+            } else {
+                executor.remove(this);
+                taskMap.remove(ref);
+            }
+        }
+    }
 }
diff --git a/java/org/apache/tomcat/dbcp/pool2/impl/GenericKeyedObjectPool.java 
b/java/org/apache/tomcat/dbcp/pool2/impl/GenericKeyedObjectPool.java
index 9cfa174..44f9c56 100644
--- a/java/org/apache/tomcat/dbcp/pool2/impl/GenericKeyedObjectPool.java
+++ b/java/org/apache/tomcat/dbcp/pool2/impl/GenericKeyedObjectPool.java
@@ -40,16 +40,16 @@ import org.apache.tomcat.dbcp.pool2.PooledObject;
 import org.apache.tomcat.dbcp.pool2.PooledObjectState;
 
 /**
- * A configurable <code>KeyedObjectPool</code> implementation.
+ * A configurable {@code KeyedObjectPool} implementation.
  * <p>
  * When coupled with the appropriate {@link KeyedPooledObjectFactory},
- * <code>GenericKeyedObjectPool</code> provides robust pooling functionality 
for
- * keyed objects. A <code>GenericKeyedObjectPool</code> can be viewed as a map
+ * {@code GenericKeyedObjectPool} provides robust pooling functionality for
+ * keyed objects. A {@code GenericKeyedObjectPool} can be viewed as a map
  * of sub-pools, keyed on the (unique) key values provided to the
  * {@link #preparePool preparePool}, {@link #addObject addObject} or
  * {@link #borrowObject borrowObject} methods. Each time a new key value is
  * provided to one of these methods, a sub-new pool is created under the given
- * key to be managed by the containing <code>GenericKeyedObjectPool.</code>
+ * key to be managed by the containing {@code GenericKeyedObjectPool.}
  * </p>
  * <p>
  * Note that the current implementation uses a ConcurrentHashMap which uses
@@ -85,16 +85,16 @@ public class GenericKeyedObjectPool<K, T> extends 
BaseGenericObjectPool<T>
         implements KeyedObjectPool<K, T>, GenericKeyedObjectPoolMXBean<K> {
 
     /**
-     * Create a new <code>GenericKeyedObjectPool</code> using defaults from
+     * Create a new {@code GenericKeyedObjectPool} using defaults from
      * {@link GenericKeyedObjectPoolConfig}.
      * @param factory the factory to be used to create entries
      */
-    public GenericKeyedObjectPool(final KeyedPooledObjectFactory<K,T> factory) 
{
+    public GenericKeyedObjectPool(final KeyedPooledObjectFactory<K, T> 
factory) {
         this(factory, new GenericKeyedObjectPoolConfig<T>());
     }
 
     /**
-     * Create a new <code>GenericKeyedObjectPool</code> using a specific
+     * Create a new {@code GenericKeyedObjectPool} using a specific
      * configuration.
      *
      * @param factory the factory to be used to create entries
@@ -278,7 +278,7 @@ public class GenericKeyedObjectPool<K, T> extends 
BaseGenericObjectPool<T>
      * associated with the given key, then an idle instance will be selected
      * based on the value of {@link #getLifo()}, activated and returned.  If
      * activation fails, or {@link #getTestOnBorrow() testOnBorrow} is set to
-     * <code>true</code> and validation fails, the instance is destroyed and 
the
+     * {@code true} and validation fails, the instance is destroyed and the
      * next available instance is examined.  This continues until either a 
valid
      * instance is returned or there are no more idle instances available.
      * <p>
@@ -286,24 +286,24 @@ public class GenericKeyedObjectPool<K, T> extends 
BaseGenericObjectPool<T>
      * the given key, behavior depends on the {@link #getMaxTotalPerKey()
      * maxTotalPerKey}, {@link #getMaxTotal() maxTotal}, and (if applicable)
      * {@link #getBlockWhenExhausted()} and the value passed in to the
-     * <code>borrowMaxWaitMillis</code> parameter. If the number of instances 
checked
+     * {@code borrowMaxWaitMillis} parameter. If the number of instances 
checked
      * out from the sub-pool under the given key is less than
-     * <code>maxTotalPerKey</code> and the total number of instances in
-     * circulation (under all keys) is less than <code>maxTotal</code>, a new
+     * {@code maxTotalPerKey} and the total number of instances in
+     * circulation (under all keys) is less than {@code maxTotal}, a new
      * instance is created, activated and (if applicable) validated and 
returned
-     * to the caller. If validation fails, a 
<code>NoSuchElementException</code>
+     * to the caller. If validation fails, a {@code NoSuchElementException}
      * will be thrown.
      * <p>
      * If the associated sub-pool is exhausted (no available idle instances and
      * no capacity to create new ones), this method will either block
      * ({@link #getBlockWhenExhausted()} is true) or throw a
-     * <code>NoSuchElementException</code>
+     * {@code NoSuchElementException}
      * ({@link #getBlockWhenExhausted()} is false).
      * The length of time that this method will block when
      * {@link #getBlockWhenExhausted()} is true is determined by the value
-     * passed in to the <code>borrowMaxWait</code> parameter.
+     * passed in to the {@code borrowMaxWait} parameter.
      * <p>
-     * When <code>maxTotal</code> is set to a positive value and this method is
+     * When {@code maxTotal} is set to a positive value and this method is
      * invoked when at the limit with no idle instances available under the 
requested
      * key, an attempt is made to create room by clearing the oldest 15% of the
      * elements from the keyed sub-pools.
@@ -547,7 +547,7 @@ public class GenericKeyedObjectPool<K, T> extends 
BaseGenericObjectPool<T>
      * {@inheritDoc}
      * <p>
      * Activation of this method decrements the active count associated with
-     * the given keyed pool and attempts to destroy <code>obj.</code>
+     * the given keyed pool and attempts to destroy {@code obj.}
      *
      * @param key pool key
      * @param obj instance to invalidate
@@ -608,7 +608,7 @@ public class GenericKeyedObjectPool<K, T> extends 
BaseGenericObjectPool<T>
 
     /**
      * Clears the specified sub-pool, removing all pooled instances
-     * corresponding to the given <code>key</code>. Exceptions encountered
+     * corresponding to the given {@code key}. Exceptions encountered
      * destroying idle instances are swallowed but notified via a
      * {@link org.apache.tomcat.dbcp.pool2.SwallowedExceptionListener}.
      *
@@ -1238,7 +1238,7 @@ public class GenericKeyedObjectPool<K, T> extends 
BaseGenericObjectPool<T>
     /**
      * Create an object using the {@link KeyedPooledObjectFactory#makeObject
      * factory}, passivate it, and then place it in the idle object pool.
-     * <code>addObject</code> is useful for "pre-loading" a pool with idle
+     * {@code addObject} is useful for "pre-loading" a pool with idle
      * objects.
      *
      * @param key the key a new instance should be added to
@@ -1558,7 +1558,7 @@ public class GenericKeyedObjectPool<K, T> extends 
BaseGenericObjectPool<T>
             GenericKeyedObjectPoolConfig.DEFAULT_MIN_IDLE_PER_KEY;
     private volatile int maxTotalPerKey =
             GenericKeyedObjectPoolConfig.DEFAULT_MAX_TOTAL_PER_KEY;
-    private final KeyedPooledObjectFactory<K,T> factory;
+    private final KeyedPooledObjectFactory<K, T> factory;
     private final boolean fairness;
 
 
@@ -1569,7 +1569,7 @@ public class GenericKeyedObjectPool<K, T> extends 
BaseGenericObjectPool<T>
      * in step with {@link #poolKeyList} using {@link #keyLock} to ensure any
      * changes to the list of current keys is made in a thread-safe manner.
      */
-    private final Map<K,ObjectDeque<T>> poolMap =
+    private final Map<K, ObjectDeque<T>> poolMap =
             new ConcurrentHashMap<>(); // @GuardedBy("keyLock") for write 
access (and some read access)
     /*
      * List of pool keys - used to control eviction order. The list of keys
diff --git a/java/org/apache/tomcat/dbcp/pool2/impl/GenericObjectPool.java 
b/java/org/apache/tomcat/dbcp/pool2/impl/GenericObjectPool.java
index a5f0034..81e66ee 100644
--- a/java/org/apache/tomcat/dbcp/pool2/impl/GenericObjectPool.java
+++ b/java/org/apache/tomcat/dbcp/pool2/impl/GenericObjectPool.java
@@ -36,7 +36,7 @@ import org.apache.tomcat.dbcp.pool2.UsageTracking;
  * A configurable {@link ObjectPool} implementation.
  * <p>
  * When coupled with the appropriate {@link PooledObjectFactory},
- * <code>GenericObjectPool</code> provides robust pooling functionality for
+ * {@code GenericObjectPool} provides robust pooling functionality for
  * arbitrary objects.
  * </p>
  * <p>
@@ -54,11 +54,11 @@ import org.apache.tomcat.dbcp.pool2.UsageTracking;
  * returned before the configured
  * {@link AbandonedConfig#getRemoveAbandonedTimeout() removeAbandonedTimeout}.
  * Abandoned object removal can be configured to happen when
- * <code>borrowObject</code> is invoked and the pool is close to starvation, or
+ * {@code borrowObject} is invoked and the pool is close to starvation, or
  * it can be executed by the idle object evictor, or both. If pooled objects
  * implement the {@link org.apache.tomcat.dbcp.pool2.TrackedUse} interface,
  * their last use will be queried
- * using the <code>getLastUsed</code> method on that interface; otherwise
+ * using the {@code getLastUsed} method on that interface; otherwise
  * abandonment is determined by how long an object has been checked out from
  * the pool.
  * </p>
@@ -81,7 +81,7 @@ public class GenericObjectPool<T> extends 
BaseGenericObjectPool<T>
         implements ObjectPool<T>, GenericObjectPoolMXBean, UsageTracking<T> {
 
     /**
-     * Creates a new <code>GenericObjectPool</code> using defaults from
+     * Creates a new {@code GenericObjectPool} using defaults from
      * {@link GenericObjectPoolConfig}.
      *
      * @param factory The object factory to be used to create object instances
@@ -92,7 +92,7 @@ public class GenericObjectPool<T> extends 
BaseGenericObjectPool<T>
     }
 
     /**
-     * Creates a new <code>GenericObjectPool</code> using a specific
+     * Creates a new {@code GenericObjectPool} using a specific
      * configuration.
      *
      * @param factory   The object factory to be used to create object 
instances
@@ -119,7 +119,7 @@ public class GenericObjectPool<T> extends 
BaseGenericObjectPool<T>
     }
 
     /**
-     * Creates a new <code>GenericObjectPool</code> that tracks and destroys
+     * Creates a new {@code GenericObjectPool} that tracks and destroys
      * objects that are checked out, but never returned to the pool.
      *
      * @param factory   The object factory to be used to create object 
instances
@@ -359,7 +359,7 @@ public class GenericObjectPool<T> extends 
BaseGenericObjectPool<T>
      * If there is one or more idle instance available in the pool, then an
      * idle instance will be selected based on the value of {@link #getLifo()},
      * activated and returned. If activation fails, or {@link 
#getTestOnBorrow()
-     * testOnBorrow} is set to <code>true</code> and validation fails, the
+     * testOnBorrow} is set to {@code true} and validation fails, the
      * instance is destroyed and the next available instance is examined. This
      * continues until either a valid instance is returned or there are no more
      * idle instances available.
@@ -368,20 +368,20 @@ public class GenericObjectPool<T> extends 
BaseGenericObjectPool<T>
      * If there are no idle instances available in the pool, behavior depends 
on
      * the {@link #getMaxTotal() maxTotal}, (if applicable)
      * {@link #getBlockWhenExhausted()} and the value passed in to the
-     * <code>borrowMaxWaitMillis</code> parameter. If the number of instances
-     * checked out from the pool is less than <code>maxTotal,</code> a new
+     * {@code borrowMaxWaitMillis} parameter. If the number of instances
+     * checked out from the pool is less than {@code maxTotal,} a new
      * instance is created, activated and (if applicable) validated and 
returned
-     * to the caller. If validation fails, a 
<code>NoSuchElementException</code>
+     * to the caller. If validation fails, a {@code NoSuchElementException}
      * is thrown.
      * </p>
      * <p>
      * If the pool is exhausted (no available idle instances and no capacity to
      * create new ones), this method will either block (if
      * {@link #getBlockWhenExhausted()} is true) or throw a
-     * <code>NoSuchElementException</code> (if
+     * {@code NoSuchElementException} (if
      * {@link #getBlockWhenExhausted()} is false). The length of time that this
      * method will block when {@link #getBlockWhenExhausted()} is true is
-     * determined by the value passed in to the 
<code>borrowMaxWaitMillis</code>
+     * determined by the value passed in to the {@code borrowMaxWaitMillis}
      * parameter.
      * </p>
      * <p>
diff --git a/java/org/apache/tomcat/dbcp/pool2/impl/LinkedBlockingDeque.java 
b/java/org/apache/tomcat/dbcp/pool2/impl/LinkedBlockingDeque.java
index 75e925e..36dad79 100644
--- a/java/org/apache/tomcat/dbcp/pool2/impl/LinkedBlockingDeque.java
+++ b/java/org/apache/tomcat/dbcp/pool2/impl/LinkedBlockingDeque.java
@@ -22,6 +22,7 @@ import java.util.Collection;
 import java.util.Deque;
 import java.util.Iterator;
 import java.util.NoSuchElementException;
+import java.util.Objects;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.locks.Condition;
 
@@ -224,9 +225,7 @@ class LinkedBlockingDeque<E> extends AbstractQueue<E>
         lock.lock(); // Never contended, but necessary for visibility
         try {
             for (final E e : c) {
-                if (e == null) {
-                    throw new NullPointerException();
-                }
+                Objects.requireNonNull(e);
                 if (!linkLast(e)) {
                     throw new IllegalStateException("Deque full");
                 }
@@ -392,9 +391,7 @@ class LinkedBlockingDeque<E> extends AbstractQueue<E>
      */
     @Override
     public boolean offerFirst(final E e) {
-        if (e == null) {
-            throw new NullPointerException();
-        }
+        Objects.requireNonNull(e, "e");
         lock.lock();
         try {
             return linkFirst(e);
@@ -408,9 +405,7 @@ class LinkedBlockingDeque<E> extends AbstractQueue<E>
      */
     @Override
     public boolean offerLast(final E e) {
-        if (e == null) {
-            throw new NullPointerException();
-        }
+        Objects.requireNonNull(e, "e");
         lock.lock();
         try {
             return linkLast(e);
@@ -430,9 +425,7 @@ class LinkedBlockingDeque<E> extends AbstractQueue<E>
      *         for space
      */
     public void putFirst(final E e) throws InterruptedException {
-        if (e == null) {
-            throw new NullPointerException();
-        }
+        Objects.requireNonNull(e, "e");
         lock.lock();
         try {
             while (!linkFirst(e)) {
@@ -454,9 +447,7 @@ class LinkedBlockingDeque<E> extends AbstractQueue<E>
      *         for space
      */
     public void putLast(final E e) throws InterruptedException {
-        if (e == null) {
-            throw new NullPointerException();
-        }
+        Objects.requireNonNull(e, "e");
         lock.lock();
         try {
             while (!linkLast(e)) {
@@ -483,9 +474,7 @@ class LinkedBlockingDeque<E> extends AbstractQueue<E>
      */
     public boolean offerFirst(final E e, final long timeout, final TimeUnit 
unit)
         throws InterruptedException {
-        if (e == null) {
-            throw new NullPointerException();
-        }
+        Objects.requireNonNull(e, "e");
         long nanos = unit.toNanos(timeout);
         lock.lockInterruptibly();
         try {
@@ -517,9 +506,7 @@ class LinkedBlockingDeque<E> extends AbstractQueue<E>
      */
     public boolean offerLast(final E e, final long timeout, final TimeUnit 
unit)
         throws InterruptedException {
-        if (e == null) {
-            throw new NullPointerException();
-        }
+        Objects.requireNonNull(e, "e");
         long nanos = unit.toNanos(timeout);
         lock.lockInterruptibly();
         try {
@@ -940,9 +927,7 @@ class LinkedBlockingDeque<E> extends AbstractQueue<E>
      * @throws IllegalArgumentException if c is this instance
      */
     public int drainTo(final Collection<? super E> c, final int maxElements) {
-        if (c == null) {
-            throw new NullPointerException();
-        }
+        Objects.requireNonNull(c, "c");
         if (c == this) {
             throw new IllegalArgumentException();
         }
diff --git 
a/java/org/apache/tomcat/dbcp/pool2/impl/SecurityManagerCallStack.java 
b/java/org/apache/tomcat/dbcp/pool2/impl/SecurityManagerCallStack.java
index 14283d6..7c21583 100644
--- a/java/org/apache/tomcat/dbcp/pool2/impl/SecurityManagerCallStack.java
+++ b/java/org/apache/tomcat/dbcp/pool2/impl/SecurityManagerCallStack.java
@@ -52,7 +52,7 @@ public class SecurityManagerCallStack implements CallStack {
     public SecurityManagerCallStack(final String messageFormat, final boolean 
useTimestamp) {
         this.messageFormat = messageFormat;
         this.dateFormat = useTimestamp ? new SimpleDateFormat(messageFormat) : 
null;
-        this.securityManager = 
AccessController.doPrivileged((PrivilegedAction<PrivateSecurityManager>) () -> 
new PrivateSecurityManager());
+        this.securityManager = 
AccessController.doPrivileged((PrivilegedAction<PrivateSecurityManager>) 
PrivateSecurityManager::new);
     }
 
     @Override
diff --git 
a/java/org/apache/tomcat/dbcp/pool2/impl/SoftReferenceObjectPool.java 
b/java/org/apache/tomcat/dbcp/pool2/impl/SoftReferenceObjectPool.java
index e989692..f9cce30 100644
--- a/java/org/apache/tomcat/dbcp/pool2/impl/SoftReferenceObjectPool.java
+++ b/java/org/apache/tomcat/dbcp/pool2/impl/SoftReferenceObjectPool.java
@@ -46,7 +46,7 @@ public class SoftReferenceObjectPool<T> extends 
BaseObjectPool<T> {
 
     /**
      * Queue of broken references that might be able to be removed from
-     * <code>_pool</code>. This is used to help {@link #getNumIdle()} be more
+     * {@code _pool}. This is used to help {@link #getNumIdle()} be more
      * accurate with minimal performance overhead.
      */
     private final ReferenceQueue<T> refQueue = new ReferenceQueue<>();
@@ -70,7 +70,7 @@ public class SoftReferenceObjectPool<T> extends 
BaseObjectPool<T> {
         new ArrayList<>();
 
     /**
-     * Create a <code>SoftReferenceObjectPool</code> with the specified 
factory.
+     * Create a {@code SoftReferenceObjectPool} with the specified factory.
      *
      * @param factory object factory to use.
      */
@@ -95,12 +95,12 @@ public class SoftReferenceObjectPool<T> extends 
BaseObjectPool<T> {
      * destroyed} and another instance is retrieved from the pool, validated 
and
      * activated. This process continues until either the pool is empty or an
      * instance passes validation. If the pool is empty on activation or it 
does
-     * not contain any valid instances, the factory's <code>makeObject</code>
+     * not contain any valid instances, the factory's {@code makeObject}
      * method is used to create a new instance. If the created instance either
      * raises an exception on activation or fails validation,
-     * <code>NoSuchElementException</code> is thrown. Exceptions thrown by
-     * <code>MakeObject</code> are propagated to the caller; but other than
-     * <code>ThreadDeath</code> or <code>VirtualMachineError</code>, exceptions
+     * {@code NoSuchElementException} is thrown. Exceptions thrown by
+     * {@code MakeObject} are propagated to the caller; but other than
+     * {@code ThreadDeath} or {@code VirtualMachineError}, exceptions
      * generated by activation, validation or destroy methods are swallowed
      * silently.
      *
@@ -257,8 +257,8 @@ public class SoftReferenceObjectPool<T> extends 
BaseObjectPool<T> {
      * validation fails, the new instance is
      * {@link PooledObjectFactory#destroyObject(
      * org.apache.tomcat.dbcp.pool2.PooledObject) destroyed}. Exceptions
-     * generated by the factory <code>makeObject</code> or
-     * <code>passivate</code> are propagated to the caller. Exceptions
+     * generated by the factory {@code makeObject} or
+     * {@code passivate} are propagated to the caller. Exceptions
      * destroying instances are silently swallowed.
      *
      * @throws IllegalStateException


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

Reply via email to