Repository: commons-pool Updated Branches: refs/heads/master 3f91164a5 -> cebb32018
[POOL-338] GenericObjectPool constructor may throw an exception under OSGi. Update POM version from 2.5.1-SNAPSHOT to 2.6.0-SNAPSHOT since we have added public APIs. Project: http://git-wip-us.apache.org/repos/asf/commons-pool/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-pool/commit/cebb3201 Tree: http://git-wip-us.apache.org/repos/asf/commons-pool/tree/cebb3201 Diff: http://git-wip-us.apache.org/repos/asf/commons-pool/diff/cebb3201 Branch: refs/heads/master Commit: cebb32018b975ee5325111091e186176fb2412f1 Parents: 3f91164 Author: Gary Gregory <garydgreg...@gmail.com> Authored: Sat May 26 09:00:05 2018 -0600 Committer: Gary Gregory <garydgreg...@gmail.com> Committed: Sat May 26 09:00:05 2018 -0600 ---------------------------------------------------------------------- pom.xml | 4 +- src/changes/changes.xml | 5 +- .../pool2/impl/BaseGenericObjectPool.java | 74 ++++++++++++++------ .../pool2/impl/BaseObjectPoolConfig.java | 42 +++++++++-- .../pool2/impl/GenericKeyedObjectPool.java | 23 +++--- .../impl/GenericKeyedObjectPoolConfig.java | 11 +-- .../commons/pool2/impl/GenericObjectPool.java | 23 +++--- .../pool2/impl/GenericObjectPoolConfig.java | 9 ++- .../pool2/impl/TestGenericObjectPool.java | 3 + 9 files changed, 141 insertions(+), 53 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/commons-pool/blob/cebb3201/pom.xml ---------------------------------------------------------------------- diff --git a/pom.xml b/pom.xml index ed6c2e0..4093990 100644 --- a/pom.xml +++ b/pom.xml @@ -26,7 +26,7 @@ </parent> <modelVersion>4.0.0</modelVersion> <artifactId>commons-pool2</artifactId> - <version>2.5.1-SNAPSHOT</version> + <version>2.6.0-SNAPSHOT</version> <name>Apache Commons Pool</name> <inceptionYear>2001</inceptionYear> @@ -156,7 +156,7 @@ <commons.componentid>pool2</commons.componentid> <commons.module.name>org.apache.commons.pool2</commons.module.name> <!-- Java 7 --> - <commons.release.version>2.5.0</commons.release.version> + <commons.release.version>2.6.0</commons.release.version> <commons.release.desc>(Java 7)</commons.release.desc> <!-- Java 6 --> <commons.release.2.version>2.4.3</commons.release.2.version> http://git-wip-us.apache.org/repos/asf/commons-pool/blob/cebb3201/src/changes/changes.xml ---------------------------------------------------------------------- diff --git a/src/changes/changes.xml b/src/changes/changes.xml index 5a3b0ae..5f8e13a 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -43,7 +43,7 @@ The <action> type attribute can be add,update,fix,remove. <title>Apache Commons Pool Changes</title> </properties> <body> - <release version="2.5.1" date="2018-MM-DD" description="This is a maintenance release."> + <release version="2.6.0" date="2018-MM-DD" description="This is a maintenance release."> <action dev="ggregory" issue="POOL-336" type="update" due-to="Wolfgang Glas"> GenericObjectPool's borrowObject lock if create() fails with Error. </action> @@ -56,6 +56,9 @@ The <action> type attribute can be add,update,fix,remove. <action dev="ggregory" issue="POOL-341" type="update"> Update optional library asm-util from 6.0 to 6.1.1. </action> + <action dev="ggregory" issue="POOL-338" type="fix" due-to="Michael C, Gary Gregory"> + GenericObjectPool constructor may throw an exception under OSGi. + </action> </release> <release version="2.5.0" date="2017-12-16" description="This is a minor release, updating to Java 7."> <action dev="ggregory" issue="POOL-331" type="update"> http://git-wip-us.apache.org/repos/asf/commons-pool/blob/cebb3201/src/main/java/org/apache/commons/pool2/impl/BaseGenericObjectPool.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/commons/pool2/impl/BaseGenericObjectPool.java b/src/main/java/org/apache/commons/pool2/impl/BaseGenericObjectPool.java index bd3e80b..2ad87f0 100644 --- a/src/main/java/org/apache/commons/pool2/impl/BaseGenericObjectPool.java +++ b/src/main/java/org/apache/commons/pool2/impl/BaseGenericObjectPool.java @@ -62,6 +62,8 @@ public abstract class BaseGenericObjectPool<T> extends BaseObject { */ public static final int MEAN_TIMING_STATS_CACHE_SIZE = 100; + private static final String EVICTION_POLICY_TYPE_NAME = EvictionPolicy.class.getName(); + // Configuration attributes private volatile int maxTotal = GenericKeyedObjectPoolConfig.DEFAULT_MAX_TOTAL; @@ -132,7 +134,7 @@ public abstract class BaseGenericObjectPool<T> extends BaseObject { * overridden by the config * @param jmxNamePrefix Prefix to be used for JMX name for the new pool */ - public BaseGenericObjectPool(final BaseObjectPoolConfig config, + public BaseGenericObjectPool(final BaseObjectPoolConfig<T> config, final String jmxNameBase, final String jmxNamePrefix) { if (config.getJmxEnabled()) { this.oname = jmxRegister(config, jmxNameBase, jmxNamePrefix); @@ -590,48 +592,78 @@ public abstract class BaseGenericObjectPool<T> extends BaseObject { } /** - * Sets the name of the {@link EvictionPolicy} implementation that is - * used by this pool. The Pool will attempt to load the class using the - * thread context class loader. If that fails, the Pool will attempt to load - * the class using the class loader that loaded this class. + * Sets the eviction policy for this pool. + * + * @param evictionPolicy + * the eviction policy for this pool. + * @since 2.6.0 + */ + public void setEvictionPolicy(EvictionPolicy<T> evictionPolicy) { + this.evictionPolicy = evictionPolicy; + } + + /** + * Sets the name of the {@link EvictionPolicy} implementation that is used by this pool. The Pool will attempt to + * load the class using the given class loader. If that fails, use the class loader for the {@link EvictionPolicy} + * interface. * - * @param evictionPolicyClassName the fully qualified class name of the - * new eviction policy + * @param evictionPolicyClassName + * the fully qualified class name of the new eviction policy + * @param classLoader + * the class loader to load the given {@code evictionPolicyClassName}. * * @see #getEvictionPolicyClassName() + * @since 2.6.0 If loading the class using the given class loader fails, use the class loader for the + * {@link EvictionPolicy} interface. */ - public final void setEvictionPolicyClassName(final String evictionPolicyClassName) { - final String EVICTION_POLICY_TYPE_NAME = EvictionPolicy.class.getName(); - final String exMessage = "Unable to create " + EVICTION_POLICY_TYPE_NAME + " instance of type " - + evictionPolicyClassName; + public final void setEvictionPolicyClassName(final String evictionPolicyClassName, final ClassLoader classLoader) { try { Class<?> clazz; - final ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); String epcnClassLoaderDesc; + // Getting epClass here and now best matches the caller's environment + final Class<?> epClass = EvictionPolicy.class; + final ClassLoader epClassLoader = epClass.getClassLoader(); try { - epcnClassLoaderDesc = "Thread context class loader: " + classLoader; + epcnClassLoaderDesc = classLoader.toString(); clazz = Class.forName(evictionPolicyClassName, true, classLoader); } catch (final ClassNotFoundException e) { - epcnClassLoaderDesc = "Default class loader"; - clazz = Class.forName(evictionPolicyClassName); + epcnClassLoaderDesc = epClassLoader.toString(); + clazz = Class.forName(evictionPolicyClassName, true, epClassLoader); } final Object policy = clazz.getConstructor().newInstance(); - if (policy instanceof EvictionPolicy<?>) { + if (epClass.isInstance(policy)) { @SuppressWarnings("unchecked") // safe, because we just checked the class final EvictionPolicy<T> evicPolicy = (EvictionPolicy<T>) policy; this.evictionPolicy = evicPolicy; } else { throw new IllegalArgumentException("Class " + evictionPolicyClassName + " from class loader [" - + epcnClassLoaderDesc + "] does not implement " + EVICTION_POLICY_TYPE_NAME - + " from class loader [" + EvictionPolicy.class.getClassLoader() + "]"); + + epcnClassLoaderDesc + "] does 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 name of the {@link EvictionPolicy} implementation that is used by this pool. The Pool will attempt to + * load the class using the thread context class loader. If that fails, the use the class loader for the + * {@link EvictionPolicy} interface. + * + * @param evictionPolicyClassName + * the fully qualified class name of the new eviction policy + * + * @see #getEvictionPolicyClassName() + * @since 2.6.0 If loading the class using the thread context class loader fails, use the class loader for the + * {@link EvictionPolicy} interface. + */ + public final void setEvictionPolicyClassName(final String evictionPolicyClassName) { + setEvictionPolicyClassName(evictionPolicyClassName, Thread.currentThread().getContextClassLoader()); + } + + /** * Gets the timeout that will be used when waiting for the Evictor to * shutdown if this pool is closed and it is the only pool still using the * the value for the Evictor. @@ -688,8 +720,9 @@ public abstract class BaseGenericObjectPool<T> extends BaseObject { * * @return the eviction policy * @since 2.4 + * @since 2.6.0 Changed access from protected to public. */ - protected EvictionPolicy<T> getEvictionPolicy() { + public EvictionPolicy<T> getEvictionPolicy() { return evictionPolicy; } @@ -960,7 +993,7 @@ public abstract class BaseGenericObjectPool<T> extends BaseObject { * @param jmxNamePrefix name prefix * @return registered ObjectName, null if registration fails */ - private ObjectName jmxRegister(final BaseObjectPoolConfig config, + private ObjectName jmxRegister(final BaseObjectPoolConfig<T> config, final String jmxNameBase, String jmxNamePrefix) { ObjectName objectName = null; final MBeanServer mbs = ManagementFactory.getPlatformMBeanServer(); @@ -1331,4 +1364,5 @@ public abstract class BaseGenericObjectPool<T> extends BaseObject { builder.append(swallowedExceptionListener); } + } http://git-wip-us.apache.org/repos/asf/commons-pool/blob/cebb3201/src/main/java/org/apache/commons/pool2/impl/BaseObjectPoolConfig.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/commons/pool2/impl/BaseObjectPoolConfig.java b/src/main/java/org/apache/commons/pool2/impl/BaseObjectPoolConfig.java index 19205db..16923ac 100644 --- a/src/main/java/org/apache/commons/pool2/impl/BaseObjectPoolConfig.java +++ b/src/main/java/org/apache/commons/pool2/impl/BaseObjectPoolConfig.java @@ -24,10 +24,12 @@ import org.apache.commons.pool2.BaseObject; * defined by the public constants. * <p> * This class is not thread-safe. - * + * </p> + * + * @param <T> Type of element pooled. * @since 2.0 */ -public abstract class BaseObjectPoolConfig extends BaseObject implements Cloneable { +public abstract class BaseObjectPoolConfig<T> extends BaseObject implements Cloneable { /** * The default value for the {@code lifo} configuration attribute. @@ -159,9 +161,7 @@ public abstract class BaseObjectPoolConfig extends BaseObject implements Cloneab * @see GenericObjectPool#getEvictionPolicyClassName() * @see GenericKeyedObjectPool#getEvictionPolicyClassName() */ - public static final String DEFAULT_EVICTION_POLICY_CLASS_NAME = - "org.apache.commons.pool2.impl.DefaultEvictionPolicy"; - + public static final String DEFAULT_EVICTION_POLICY_CLASS_NAME = DefaultEvictionPolicy.class.getName(); private boolean lifo = DEFAULT_LIFO; @@ -181,6 +181,8 @@ public abstract class BaseObjectPoolConfig extends BaseObject implements Cloneab private int numTestsPerEvictionRun = DEFAULT_NUM_TESTS_PER_EVICTION_RUN; + private EvictionPolicy<T> evictionPolicy = null; // Only 2.6 applications set this + private String evictionPolicyClassName = DEFAULT_EVICTION_POLICY_CLASS_NAME; private boolean testOnCreate = DEFAULT_TEST_ON_CREATE; @@ -553,6 +555,21 @@ public abstract class BaseObjectPoolConfig extends BaseObject implements Cloneab } /** + * Get the value for the {@code evictionPolicyClass} configuration + * attribute for pools created with this configuration instance. + * + * @return The current setting of {@code evictionPolicyClass} for this + * configuration instance + * + * @see GenericObjectPool#getEvictionPolicy() + * @see GenericKeyedObjectPool#getEvictionPolicy() + * @since 2.6.0 + */ + public EvictionPolicy<T> getEvictionPolicy() { + return evictionPolicy; + } + + /** * Get the value for the {@code evictionPolicyClassName} configuration * attribute for pools created with this configuration instance. * @@ -567,6 +584,21 @@ public abstract class BaseObjectPoolConfig extends BaseObject implements Cloneab } /** + * Set the value for the {@code evictionPolicyClass} configuration + * attribute for pools created with this configuration instance. + * + * @param evictionPolicy The new setting of + * {@code evictionPolicyClass} for this configuration instance + * + * @see GenericObjectPool#getEvictionPolicy() + * @see GenericKeyedObjectPool#getEvictionPolicy() + * @since 2.6.0 + */ + public void setEvictionPolicy(final EvictionPolicy<T> evictionPolicy) { + this.evictionPolicy = evictionPolicy; + } + + /** * Set the value for the {@code evictionPolicyClassName} configuration * attribute for pools created with this configuration instance. * http://git-wip-us.apache.org/repos/asf/commons-pool/blob/cebb3201/src/main/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java b/src/main/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java index 2a6e225..066807a 100644 --- a/src/main/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java +++ b/src/main/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java @@ -86,7 +86,7 @@ public class GenericKeyedObjectPool<K,T> extends BaseGenericObjectPool<T> * @param factory the factory to be used to create entries */ public GenericKeyedObjectPool(final KeyedPooledObjectFactory<K,T> factory) { - this(factory, new GenericKeyedObjectPoolConfig()); + this(factory, new GenericKeyedObjectPoolConfig<T>()); } /** @@ -99,8 +99,8 @@ public class GenericKeyedObjectPool<K,T> extends BaseGenericObjectPool<T> * the configuration object will not be reflected in the * pool. */ - public GenericKeyedObjectPool(final KeyedPooledObjectFactory<K,T> factory, - final GenericKeyedObjectPoolConfig config) { + public GenericKeyedObjectPool(final KeyedPooledObjectFactory<K, T> factory, + final GenericKeyedObjectPoolConfig<T> config) { super(config, ONAME_BASE, config.getJmxNamePrefix()); @@ -238,7 +238,7 @@ public class GenericKeyedObjectPool<K,T> extends BaseGenericObjectPool<T> * * @see GenericKeyedObjectPoolConfig */ - public void setConfig(final GenericKeyedObjectPoolConfig conf) { + public void setConfig(final GenericKeyedObjectPoolConfig<T> conf) { setLifo(conf.getLifo()); setMaxIdlePerKey(conf.getMaxIdlePerKey()); setMaxTotalPerKey(conf.getMaxTotalPerKey()); @@ -252,11 +252,16 @@ public class GenericKeyedObjectPool<K,T> extends BaseGenericObjectPool<T> setTestWhileIdle(conf.getTestWhileIdle()); setNumTestsPerEvictionRun(conf.getNumTestsPerEvictionRun()); setMinEvictableIdleTimeMillis(conf.getMinEvictableIdleTimeMillis()); - setSoftMinEvictableIdleTimeMillis( - conf.getSoftMinEvictableIdleTimeMillis()); - setTimeBetweenEvictionRunsMillis( - conf.getTimeBetweenEvictionRunsMillis()); - setEvictionPolicyClassName(conf.getEvictionPolicyClassName()); + setSoftMinEvictableIdleTimeMillis(conf.getSoftMinEvictableIdleTimeMillis()); + setTimeBetweenEvictionRunsMillis(conf.getTimeBetweenEvictionRunsMillis()); + final EvictionPolicy<T> policy = conf.getEvictionPolicy(); + if (policy == null) { + // Use the class name (pre-2.6.0 compatible) + setEvictionPolicyClassName(conf.getEvictionPolicyClassName()); + } else { + // Otherwise, use the class (2.6.0 feature) + setEvictionPolicy(policy); + } setEvictorShutdownTimeoutMillis(conf.getEvictorShutdownTimeoutMillis()); } http://git-wip-us.apache.org/repos/asf/commons-pool/blob/cebb3201/src/main/java/org/apache/commons/pool2/impl/GenericKeyedObjectPoolConfig.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/commons/pool2/impl/GenericKeyedObjectPoolConfig.java b/src/main/java/org/apache/commons/pool2/impl/GenericKeyedObjectPoolConfig.java index 57da4ae..6be1026 100644 --- a/src/main/java/org/apache/commons/pool2/impl/GenericKeyedObjectPoolConfig.java +++ b/src/main/java/org/apache/commons/pool2/impl/GenericKeyedObjectPoolConfig.java @@ -23,10 +23,12 @@ package org.apache.commons.pool2.impl; * <p> * This class is not thread-safe; it is only intended to be used to provide * attributes used when creating a pool. - * + * </p> + * + * @param <T> Type of element pooled. * @since 2.0 */ -public class GenericKeyedObjectPoolConfig extends BaseObjectPoolConfig { +public class GenericKeyedObjectPoolConfig<T> extends BaseObjectPoolConfig<T> { /** * The default value for the {@code maxTotalPerKey} configuration attribute. @@ -171,10 +173,11 @@ public class GenericKeyedObjectPoolConfig extends BaseObjectPoolConfig { this.maxIdlePerKey = maxIdlePerKey; } + @SuppressWarnings("unchecked") @Override - public GenericKeyedObjectPoolConfig clone() { + public GenericKeyedObjectPoolConfig<T> clone() { try { - return (GenericKeyedObjectPoolConfig) super.clone(); + return (GenericKeyedObjectPoolConfig<T>) super.clone(); } catch (final CloneNotSupportedException e) { throw new AssertionError(); // Can't happen } http://git-wip-us.apache.org/repos/asf/commons-pool/blob/cebb3201/src/main/java/org/apache/commons/pool2/impl/GenericObjectPool.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/commons/pool2/impl/GenericObjectPool.java b/src/main/java/org/apache/commons/pool2/impl/GenericObjectPool.java index a6a9f53..a4c14ec 100644 --- a/src/main/java/org/apache/commons/pool2/impl/GenericObjectPool.java +++ b/src/main/java/org/apache/commons/pool2/impl/GenericObjectPool.java @@ -85,7 +85,7 @@ public class GenericObjectPool<T> extends BaseGenericObjectPool<T> * used by this pool */ public GenericObjectPool(final PooledObjectFactory<T> factory) { - this(factory, new GenericObjectPoolConfig()); + this(factory, new GenericObjectPoolConfig<T>()); } /** @@ -100,7 +100,7 @@ public class GenericObjectPool<T> extends BaseGenericObjectPool<T> * pool. */ public GenericObjectPool(final PooledObjectFactory<T> factory, - final GenericObjectPoolConfig config) { + final GenericObjectPoolConfig<T> config) { super(config, ONAME_BASE, config.getJmxNamePrefix()); @@ -131,7 +131,7 @@ public class GenericObjectPool<T> extends BaseGenericObjectPool<T> * and removal. The configuration is used by value. */ public GenericObjectPool(final PooledObjectFactory<T> factory, - final GenericObjectPoolConfig config, final AbandonedConfig abandonedConfig) { + final GenericObjectPoolConfig<T> config, final AbandonedConfig abandonedConfig) { this(factory, config); setAbandonedConfig(abandonedConfig); } @@ -298,7 +298,7 @@ public class GenericObjectPool<T> extends BaseGenericObjectPool<T> * * @see GenericObjectPoolConfig */ - public void setConfig(final GenericObjectPoolConfig conf) { + public void setConfig(final GenericObjectPoolConfig<T> conf) { setLifo(conf.getLifo()); setMaxIdle(conf.getMaxIdle()); setMinIdle(conf.getMinIdle()); @@ -311,11 +311,16 @@ public class GenericObjectPool<T> extends BaseGenericObjectPool<T> setTestWhileIdle(conf.getTestWhileIdle()); setNumTestsPerEvictionRun(conf.getNumTestsPerEvictionRun()); setMinEvictableIdleTimeMillis(conf.getMinEvictableIdleTimeMillis()); - setTimeBetweenEvictionRunsMillis( - conf.getTimeBetweenEvictionRunsMillis()); - setSoftMinEvictableIdleTimeMillis( - conf.getSoftMinEvictableIdleTimeMillis()); - setEvictionPolicyClassName(conf.getEvictionPolicyClassName()); + setTimeBetweenEvictionRunsMillis(conf.getTimeBetweenEvictionRunsMillis()); + setSoftMinEvictableIdleTimeMillis(conf.getSoftMinEvictableIdleTimeMillis()); + final EvictionPolicy<T> policy = conf.getEvictionPolicy(); + if (policy == null) { + // Use the class name (pre-2.6.0 compatible) + setEvictionPolicyClassName(conf.getEvictionPolicyClassName()); + } else { + // Otherwise, use the class (2.6.0 feature) + setEvictionPolicy(policy); + } setEvictorShutdownTimeoutMillis(conf.getEvictorShutdownTimeoutMillis()); } http://git-wip-us.apache.org/repos/asf/commons-pool/blob/cebb3201/src/main/java/org/apache/commons/pool2/impl/GenericObjectPoolConfig.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/commons/pool2/impl/GenericObjectPoolConfig.java b/src/main/java/org/apache/commons/pool2/impl/GenericObjectPoolConfig.java index 55a131f..c046795 100644 --- a/src/main/java/org/apache/commons/pool2/impl/GenericObjectPoolConfig.java +++ b/src/main/java/org/apache/commons/pool2/impl/GenericObjectPoolConfig.java @@ -23,10 +23,12 @@ package org.apache.commons.pool2.impl; * <p> * This class is not thread-safe; it is only intended to be used to provide * attributes used when creating a pool. + * </p> * + * @param <T> Type of element pooled. * @since 2.0 */ -public class GenericObjectPoolConfig extends BaseObjectPoolConfig { +public class GenericObjectPoolConfig<T> extends BaseObjectPoolConfig<T> { /** * The default value for the {@code maxTotal} configuration attribute. @@ -133,10 +135,11 @@ public class GenericObjectPoolConfig extends BaseObjectPoolConfig { this.minIdle = minIdle; } + @SuppressWarnings("unchecked") @Override - public GenericObjectPoolConfig clone() { + public GenericObjectPoolConfig<T> clone() { try { - return (GenericObjectPoolConfig) super.clone(); + return (GenericObjectPoolConfig<T>) super.clone(); } catch (final CloneNotSupportedException e) { throw new AssertionError(); // Can't happen } http://git-wip-us.apache.org/repos/asf/commons-pool/blob/cebb3201/src/test/java/org/apache/commons/pool2/impl/TestGenericObjectPool.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/pool2/impl/TestGenericObjectPool.java b/src/test/java/org/apache/commons/pool2/impl/TestGenericObjectPool.java index 0abc55b..915e083 100644 --- a/src/test/java/org/apache/commons/pool2/impl/TestGenericObjectPool.java +++ b/src/test/java/org/apache/commons/pool2/impl/TestGenericObjectPool.java @@ -1073,6 +1073,9 @@ public class TestGenericObjectPool extends TestBaseObjectPool { // expected } + genericObjectPool.setEvictionPolicy(new TestEvictionPolicy<String>()); + assertEquals(TestEvictionPolicy.class.getName(), genericObjectPool.getEvictionPolicyClassName()); + genericObjectPool.setEvictionPolicyClassName(TestEvictionPolicy.class.getName()); assertEquals(TestEvictionPolicy.class.getName(), genericObjectPool.getEvictionPolicyClassName());