Why exactly do we need to s/Time/Duration in all of the method names? Duration is a measure of time. I don't get why this is necessary and it will force people to change (eventually). I was +1 to get rid of the "millis" in the names, but this change seems needless to me. Also, there are still quite a few places where the text of the javadoc refers to milliseconds. Was this discussed before and I missed it?
Phil On Tue, Jul 18, 2023 at 7:25 AM <ggreg...@apache.org> wrote: > This is an automated email from the ASF dual-hosted git repository. > > ggregory pushed a commit to branch POOL_2_X > in repository https://gitbox.apache.org/repos/asf/commons-pool.git > > > The following commit(s) were added to refs/heads/POOL_2_X by this push: > new 9d2f4af1 Add Duration named APIs and deprecate old APIs. > 9d2f4af1 is described below > > commit 9d2f4af14dde121271c1bb862d4b1f236072eb2a > Author: Gary Gregory <garydgreg...@gmail.com> > AuthorDate: Tue Jul 18 10:25:03 2023 -0400 > > Add Duration named APIs and > deprecate old APIs. > > Eases migration to 3.0.0 > --- > .../commons/pool2/impl/BaseGenericObjectPool.java | 102 > +++++++++++++++++---- > .../commons/pool2/impl/BaseObjectPoolConfig.java | 32 ++++++- > .../commons/pool2/impl/GenericKeyedObjectPool.java | 2 +- > .../commons/pool2/impl/GenericObjectPool.java | 2 +- > .../apache/commons/pool2/ObjectPoolIssue326.java | 2 + > .../java/org/apache/commons/pool2/PoolTest.java | 2 +- > .../pool2/impl/TestAbandonedKeyedObjectPool.java | 2 +- > .../pool2/impl/TestAbandonedObjectPool.java | 2 +- > .../pool2/impl/TestGenericKeyedObjectPool.java | 5 +- > .../commons/pool2/impl/TestGenericObjectPool.java | 6 +- > .../impl/TestGenericObjectPoolClassLoaders.java | 4 +- > .../TestGenericObjectPoolFactoryCreateFailure.java | 3 +- > 12 files changed, 131 insertions(+), 33 deletions(-) > > 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 4277ce86..fc95ba32 100644 > --- > a/src/main/java/org/apache/commons/pool2/impl/BaseGenericObjectPool.java > +++ > b/src/main/java/org/apache/commons/pool2/impl/BaseGenericObjectPool.java > @@ -867,7 +867,7 @@ public abstract class BaseGenericObjectPool<T> extends > BaseObject implements Aut > /** > * Gets 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 #setTimeBetweenEvictionRuns(Duration)}). When > non-positive, > + * see {@link #setDurationBetweenEvictionRuns(Duration)}). When > non-positive, > * no objects will be evicted from the pool due to idle time alone. > * > * @return minimum amount of time an object may sit idle in the pool > before > @@ -884,7 +884,7 @@ public abstract class BaseGenericObjectPool<T> extends > BaseObject implements Aut > /** > * Gets 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 #setTimeBetweenEvictionRuns(Duration)}). When > non-positive, > + * see {@link #setDurationBetweenEvictionRuns(Duration)}). When > non-positive, > * no objects will be evicted from the pool due to idle time alone. > * > * @return minimum amount of time an object may sit idle in the pool > before > @@ -1017,7 +1017,7 @@ public abstract class BaseGenericObjectPool<T> > extends BaseObject implements Aut > /** > * Gets 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 #setTimeBetweenEvictionRuns(Duration)}), > + * see {@link #setDurationBetweenEvictionRuns(Duration)}), > * with the extra condition that at least {@code minIdle} object > * instances remain in the pool. This setting is overridden by > * {@link #getMinEvictableIdleTime} (that is, if > @@ -1027,7 +1027,7 @@ public abstract class BaseGenericObjectPool<T> > extends BaseObject implements Aut > * @return minimum amount of time an object may sit idle in the pool > before > * it is eligible for eviction if minIdle instances are > available > * > - * @see #setSoftMinEvictableIdle(Duration) > + * @see #setSoftMinEvictableIdleDuration(Duration) > * @since 2.11.0 > */ > public final Duration getSoftMinEvictableIdleDuration() { > @@ -1037,7 +1037,7 @@ public abstract class BaseGenericObjectPool<T> > extends BaseObject implements Aut > /** > * Gets 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 #setTimeBetweenEvictionRuns(Duration)}), > + * see {@link #setDurationBetweenEvictionRuns(Duration)}), > * with the extra condition that at least {@code minIdle} object > * instances remain in the pool. This setting is overridden by > * {@link #getMinEvictableIdleTime} (that is, if > @@ -1047,7 +1047,7 @@ public abstract class BaseGenericObjectPool<T> > extends BaseObject implements Aut > * @return minimum amount of time an object may sit idle in the pool > before > * it is eligible for eviction if minIdle instances are > available > * > - * @see #setSoftMinEvictableIdle(Duration) > + * @see #setSoftMinEvictableIdleDuration(Duration) > * @since 2.10.0 > * @deprecated Use {@link #getSoftMinEvictableIdleDuration}. > */ > @@ -1175,7 +1175,7 @@ public abstract class BaseGenericObjectPool<T> > extends BaseObject implements Aut > /** > * Gets whether objects sitting idle in the pool will be validated by > the > * idle object evictor (if any - see > - * {@link #setTimeBetweenEvictionRuns(Duration)}). Validation is > performed > + * {@link #setDurationBetweenEvictionRuns(Duration)}). 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. > @@ -1369,9 +1369,9 @@ public abstract class BaseGenericObjectPool<T> > extends BaseObject implements Aut > setTestOnReturn(config.getTestOnReturn()); > setTestWhileIdle(config.getTestWhileIdle()); > setNumTestsPerEvictionRun(config.getNumTestsPerEvictionRun()); > - setMinEvictableIdle(config.getMinEvictableIdleDuration()); > - > setTimeBetweenEvictionRuns(config.getDurationBetweenEvictionRuns()); > - setSoftMinEvictableIdle(config.getSoftMinEvictableIdleDuration()); > + setMinEvictableIdleDuration(config.getMinEvictableIdleDuration()); > + > setDurationBetweenEvictionRuns(config.getDurationBetweenEvictionRuns()); > + > setSoftMinEvictableIdleDuration(config.getSoftMinEvictableIdleDuration()); > final EvictionPolicy<T> policy = config.getEvictionPolicy(); > if (policy == null) { > // Use the class name (pre-2.6.0 compatible) > @@ -1383,6 +1383,24 @@ public abstract class BaseGenericObjectPool<T> > extends BaseObject implements Aut > > setEvictorShutdownTimeout(config.getEvictorShutdownTimeoutDuration()); > } > > + /** > + * Sets the number of milliseconds to sleep between runs of the idle > object evictor thread. > + * <ul> > + * <li>When positive, the idle object evictor thread starts.</li> > + * <li>When non-positive, no idle object evictor thread runs.</li> > + * </ul> > + * > + * @param timeBetweenEvictionRuns > + * duration to sleep between evictor runs > + * > + * @see #getDurationBetweenEvictionRuns() > + * @since 2.12.0 > + */ > + public final void setDurationBetweenEvictionRuns(final Duration > timeBetweenEvictionRuns) { > + this.durationBetweenEvictionRuns = > PoolImplUtils.nonNull(timeBetweenEvictionRuns, > BaseObjectPoolConfig.DEFAULT_DURATION_BETWEEN_EVICTION_RUNS); > + startEvictor(this.durationBetweenEvictionRuns); > + } > + > /** > * Sets the eviction policy for this pool. > * > @@ -1585,7 +1603,7 @@ public abstract class BaseGenericObjectPool<T> > extends BaseObject implements Aut > /** > * 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 #setTimeBetweenEvictionRuns(Duration)}). When > non-positive, > + * see {@link #setDurationBetweenEvictionRuns(Duration)}). When > non-positive, > * no objects will be evicted from the pool due to idle time alone. > * > * @param minEvictableIdleTime > @@ -1595,7 +1613,9 @@ public abstract class BaseGenericObjectPool<T> > extends BaseObject implements Aut > * @see #getMinEvictableIdleTime > * @see #setTimeBetweenEvictionRuns > * @since 2.11.0 > + * @deprecated Use {@link #setMinEvictableIdleDuration(Duration)}. > */ > + @Deprecated > public final void setMinEvictableIdle(final Duration > minEvictableIdleTime) { > this.minEvictableIdleDuration = > PoolImplUtils.nonNull(minEvictableIdleTime, > BaseObjectPoolConfig.DEFAULT_MIN_EVICTABLE_IDLE_DURATION); > } > @@ -1603,7 +1623,25 @@ public abstract class BaseGenericObjectPool<T> > extends BaseObject implements Aut > /** > * 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 #setTimeBetweenEvictionRuns(Duration)}). When > non-positive, > + * see {@link #setDurationBetweenEvictionRuns(Duration)}). When > non-positive, > + * no objects will be evicted from the pool due to idle time alone. > + * > + * @param minEvictableIdleTime > + * minimum amount of time an object may sit idle in the > pool > + * before it is eligible for eviction > + * > + * @see #getMinEvictableIdleTime > + * @see #setTimeBetweenEvictionRuns > + * @since 2.12.0 > + */ > + public final void setMinEvictableIdleDuration(final Duration > minEvictableIdleTime) { > + this.minEvictableIdleDuration = > PoolImplUtils.nonNull(minEvictableIdleTime, > BaseObjectPoolConfig.DEFAULT_MIN_EVICTABLE_IDLE_DURATION); > + } > + > + /** > + * 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 #setDurationBetweenEvictionRuns(Duration)}). When > non-positive, > * no objects will be evicted from the pool due to idle time alone. > * > * @param minEvictableIdleTime > @@ -1613,7 +1651,7 @@ public abstract class BaseGenericObjectPool<T> > extends BaseObject implements Aut > * @see #getMinEvictableIdleTime > * @see #setTimeBetweenEvictionRuns > * @since 2.10.0 > - * @deprecated Use {@link #setMinEvictableIdle(Duration)}. > + * @deprecated Use {@link #setMinEvictableIdleDuration(Duration)}. > */ > @Deprecated > public final void setMinEvictableIdleTime(final Duration > minEvictableIdleTime) { > @@ -1662,7 +1700,7 @@ public abstract class BaseGenericObjectPool<T> > extends BaseObject implements Aut > /** > * 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 #setTimeBetweenEvictionRuns(Duration)}), > + * see {@link #setDurationBetweenEvictionRuns(Duration)}), > * with the extra condition that at least {@code minIdle} object > * instances remain in the pool. This setting is overridden by > * {@link #getMinEvictableIdleTime} (that is, if > @@ -1676,7 +1714,9 @@ public abstract class BaseGenericObjectPool<T> > extends BaseObject implements Aut > * > * @see #getSoftMinEvictableIdleTimeMillis > * @since 2.11.0 > + * @deprecated Use {@link #setSoftMinEvictableIdleDuration(Duration)}. > */ > + @Deprecated > public final void setSoftMinEvictableIdle(final Duration > softMinEvictableIdleTime) { > this.softMinEvictableIdleDuration = > PoolImplUtils.nonNull(softMinEvictableIdleTime, > BaseObjectPoolConfig.DEFAULT_SOFT_MIN_EVICTABLE_IDLE_DURATION); > } > @@ -1684,7 +1724,29 @@ public abstract class BaseGenericObjectPool<T> > extends BaseObject implements Aut > /** > * 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 #setTimeBetweenEvictionRuns(Duration)}), > + * see {@link #setDurationBetweenEvictionRuns(Duration)}), > + * with the extra condition that at least {@code minIdle} object > + * instances remain in the pool. This setting is overridden by > + * {@link #getMinEvictableIdleTime} (that is, if > + * {@link #getMinEvictableIdleTime} is positive, then > + * {@link #getSoftMinEvictableIdleTime} is ignored). > + * > + * @param softMinEvictableIdleTime > + * minimum amount of time an object may sit idle in the > pool > + * before it is eligible for eviction if minIdle instances > are > + * available > + * > + * @see #getSoftMinEvictableIdleTimeMillis > + * @since 2.12.0 > + */ > + public final void setSoftMinEvictableIdleDuration(final Duration > softMinEvictableIdleTime) { > + this.softMinEvictableIdleDuration = > PoolImplUtils.nonNull(softMinEvictableIdleTime, > BaseObjectPoolConfig.DEFAULT_SOFT_MIN_EVICTABLE_IDLE_DURATION); > + } > + > + /** > + * 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 #setDurationBetweenEvictionRuns(Duration)}), > * with the extra condition that at least {@code minIdle} object > * instances remain in the pool. This setting is overridden by > * {@link #getMinEvictableIdleTime} (that is, if > @@ -1698,7 +1760,7 @@ public abstract class BaseGenericObjectPool<T> > extends BaseObject implements Aut > * > * @see #getSoftMinEvictableIdleTimeMillis > * @since 2.10.0 > - * @deprecated Use {@link #setSoftMinEvictableIdle(Duration)}. > + * @deprecated Use {@link #setSoftMinEvictableIdleDuration(Duration)}. > */ > @Deprecated > public final void setSoftMinEvictableIdleTime(final Duration > softMinEvictableIdleTime) { > @@ -1721,7 +1783,7 @@ public abstract class BaseGenericObjectPool<T> > extends BaseObject implements Aut > * available > * > * @see #getSoftMinEvictableIdleTimeMillis > - * @deprecated Use {@link #setSoftMinEvictableIdle(Duration)}. > + * @deprecated Use {@link #setSoftMinEvictableIdleDuration(Duration)}. > */ > @Deprecated > public final void setSoftMinEvictableIdleTimeMillis(final long > softMinEvictableIdleTimeMillis) { > @@ -1797,7 +1859,7 @@ public abstract class BaseGenericObjectPool<T> > extends BaseObject implements Aut > /** > * Sets whether objects sitting idle in the pool will be validated by > the > * idle object evictor (if any - see > - * {@link #setTimeBetweenEvictionRuns(Duration)}). Validation is > performed > + * {@link #setDurationBetweenEvictionRuns(Duration)}). 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. Note that setting this property has no > effect > @@ -1826,7 +1888,9 @@ public abstract class BaseGenericObjectPool<T> > extends BaseObject implements Aut > * > * @see #getDurationBetweenEvictionRuns() > * @since 2.10.0 > + * @deprecated Use {@link #setDurationBetweenEvictionRuns(Duration)}. > */ > + @Deprecated > public final void setTimeBetweenEvictionRuns(final Duration > timeBetweenEvictionRuns) { > this.durationBetweenEvictionRuns = > PoolImplUtils.nonNull(timeBetweenEvictionRuns, > BaseObjectPoolConfig.DEFAULT_DURATION_BETWEEN_EVICTION_RUNS); > startEvictor(this.durationBetweenEvictionRuns); > @@ -1843,7 +1907,7 @@ public abstract class BaseGenericObjectPool<T> > extends BaseObject implements Aut > * number of milliseconds to sleep between evictor runs > * > * @see #getDurationBetweenEvictionRuns() > - * @deprecated Use {@link #setTimeBetweenEvictionRuns(Duration)}. > + * @deprecated Use {@link #setDurationBetweenEvictionRuns(Duration)}. > */ > @Deprecated > public final void setTimeBetweenEvictionRunsMillis(final long > timeBetweenEvictionRunsMillis) { > 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 101e17e9..7c72fa26 100644 > --- a/src/main/java/org/apache/commons/pool2/impl/BaseObjectPoolConfig.java > +++ b/src/main/java/org/apache/commons/pool2/impl/BaseObjectPoolConfig.java > @@ -762,6 +762,18 @@ public abstract class BaseObjectPoolConfig<T> extends > BaseObject implements Clon > setMaxWait(Duration.ofMillis(maxWaitMillis)); > } > > + /** > + * Sets the value for the {@code minEvictableIdleTime} configuration > attribute for pools created with this configuration instance. > + * > + * @param minEvictableIdleTime The new setting of {@code > minEvictableIdleTime} for this configuration instance > + * @see GenericObjectPool#getMinEvictableIdleDuration() > + * @see GenericKeyedObjectPool#getMinEvictableIdleDuration() > + * @since 2.12.0 > + */ > + public void setMinEvictableIdleDuration(final Duration > minEvictableIdleTime) { > + this.minEvictableIdleDuration = > PoolImplUtils.nonNull(minEvictableIdleTime, > DEFAULT_MIN_EVICTABLE_IDLE_TIME); > + } > + > /** > * Sets the value for the {@code minEvictableIdleTime} configuration > attribute for pools created with this configuration instance. > * > @@ -769,7 +781,9 @@ public abstract class BaseObjectPoolConfig<T> extends > BaseObject implements Clon > * @see GenericObjectPool#getMinEvictableIdleDuration() > * @see GenericKeyedObjectPool#getMinEvictableIdleDuration() > * @since 2.10.0 > + * @deprecated Use {@link #setMinEvictableIdleDuration(Duration)}. > */ > + @Deprecated > public void setMinEvictableIdleTime(final Duration > minEvictableIdleTime) { > this.minEvictableIdleDuration = > PoolImplUtils.nonNull(minEvictableIdleTime, > DEFAULT_MIN_EVICTABLE_IDLE_TIME); > } > @@ -780,7 +794,7 @@ public abstract class BaseObjectPoolConfig<T> extends > BaseObject implements Clon > * @param minEvictableIdleTimeMillis The new setting of {@code > minEvictableIdleTime} for this configuration instance > * @see GenericObjectPool#getMinEvictableIdleDuration() > * @see GenericKeyedObjectPool#getMinEvictableIdleDuration() > - * @deprecated Use {@link #setMinEvictableIdleTime(Duration)}. > + * @deprecated Use {@link #setMinEvictableIdleDuration(Duration)}. > */ > @Deprecated > public void setMinEvictableIdleTimeMillis(final long > minEvictableIdleTimeMillis) { > @@ -798,6 +812,18 @@ public abstract class BaseObjectPoolConfig<T> extends > BaseObject implements Clon > this.numTestsPerEvictionRun = numTestsPerEvictionRun; > } > > + /** > + * Sets the value for the {@code softMinEvictableIdleTime} > configuration attribute for pools created with this configuration instance. > + * > + * @param softMinEvictableIdleTime The new setting of {@code > softMinEvictableIdleTime} for this configuration instance > + * @see GenericObjectPool#getSoftMinEvictableIdleDuration() > + * @see GenericKeyedObjectPool#getSoftMinEvictableIdleDuration() > + * @since 2.12.0 > + */ > + public void setSoftMinEvictableIdleDuration(final Duration > softMinEvictableIdleTime) { > + this.softMinEvictableIdleDuration = > PoolImplUtils.nonNull(softMinEvictableIdleTime, > DEFAULT_SOFT_MIN_EVICTABLE_IDLE_TIME); > + } > + > /** > * Sets the value for the {@code softMinEvictableIdleTime} > configuration attribute for pools created with this configuration instance. > * > @@ -805,7 +831,9 @@ public abstract class BaseObjectPoolConfig<T> extends > BaseObject implements Clon > * @see GenericObjectPool#getSoftMinEvictableIdleDuration() > * @see GenericKeyedObjectPool#getSoftMinEvictableIdleDuration() > * @since 2.10.0 > + * @deprecated Use {@link #setSoftMinEvictableIdleDuration(Duration)}. > */ > + @Deprecated > public void setSoftMinEvictableIdleTime(final Duration > softMinEvictableIdleTime) { > this.softMinEvictableIdleDuration = > PoolImplUtils.nonNull(softMinEvictableIdleTime, > DEFAULT_SOFT_MIN_EVICTABLE_IDLE_TIME); > } > @@ -816,7 +844,7 @@ public abstract class BaseObjectPoolConfig<T> extends > BaseObject implements Clon > * @param softMinEvictableIdleTimeMillis The new setting of {@code > softMinEvictableIdleTime} for this configuration instance > * @see GenericObjectPool#getSoftMinEvictableIdleDuration() > * @see GenericKeyedObjectPool#getSoftMinEvictableIdleDuration() > - * @deprecated Use {@link #setSoftMinEvictableIdleTime(Duration)}. > + * @deprecated Use {@link #setSoftMinEvictableIdleDuration(Duration)}. > */ > @Deprecated > public void setSoftMinEvictableIdleTimeMillis(final long > softMinEvictableIdleTimeMillis) { > 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 eb1b24c9..2ceea0f5 100644 > --- > a/src/main/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java > +++ > b/src/main/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java > @@ -1678,7 +1678,7 @@ public class GenericKeyedObjectPool<K, T> extends > BaseGenericObjectPool<T> > * > * @see #getMinIdlePerKey() > * @see #getMaxIdlePerKey() > - * @see #setTimeBetweenEvictionRuns(Duration) > + * @see #setDurationBetweenEvictionRuns(Duration) > */ > public void setMinIdlePerKey(final int minIdlePerKey) { > this.minIdlePerKey = minIdlePerKey; > 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 2de037e8..b638da77 100644 > --- a/src/main/java/org/apache/commons/pool2/impl/GenericObjectPool.java > +++ b/src/main/java/org/apache/commons/pool2/impl/GenericObjectPool.java > @@ -858,7 +858,7 @@ public class GenericObjectPool<T> extends > BaseGenericObjectPool<T> > * > * @see #setMinIdle(int) > * @see #setMaxIdle(int) > - * @see #setTimeBetweenEvictionRuns(Duration) > + * @see #setDurationBetweenEvictionRuns(Duration) > */ > @Override > public int getMinIdle() { > diff --git > a/src/test/java/org/apache/commons/pool2/ObjectPoolIssue326.java > b/src/test/java/org/apache/commons/pool2/ObjectPoolIssue326.java > index d49e3ce2..cf864617 100644 > --- a/src/test/java/org/apache/commons/pool2/ObjectPoolIssue326.java > +++ b/src/test/java/org/apache/commons/pool2/ObjectPoolIssue326.java > @@ -118,7 +118,9 @@ public final class ObjectPoolIssue326 { > poolConfig.setLifo(true); > poolConfig.setFairness(true); > poolConfig.setMaxWait(Duration.ofSeconds(30)); > + poolConfig.setMinEvictableIdleDuration(Duration.ofMillis(-1)); > poolConfig.setMinEvictableIdleTime(Duration.ofMillis(-1)); > + poolConfig.setSoftMinEvictableIdleDuration(Duration.ofMillis(-1)); > poolConfig.setSoftMinEvictableIdleTime(Duration.ofMillis(-1)); > poolConfig.setNumTestsPerEvictionRun(1); > poolConfig.setTestOnCreate(false); > diff --git a/src/test/java/org/apache/commons/pool2/PoolTest.java > b/src/test/java/org/apache/commons/pool2/PoolTest.java > index 973dbc58..7ecfcd18 100644 > --- a/src/test/java/org/apache/commons/pool2/PoolTest.java > +++ b/src/test/java/org/apache/commons/pool2/PoolTest.java > @@ -79,7 +79,7 @@ public class PoolTest { > > pool.setTimeBetweenEvictionRunsMillis(EVICTION_PERIOD_IN_MILLIS); > assertEquals(EVICTION_PERIOD_IN_MILLIS, > pool.getDurationBetweenEvictionRuns().toMillis()); > assertEquals(EVICTION_PERIOD_IN_MILLIS, > pool.getTimeBetweenEvictionRuns().toMillis()); > - > pool.setTimeBetweenEvictionRuns(Duration.ofMillis(EVICTION_PERIOD_IN_MILLIS)); > + > pool.setDurationBetweenEvictionRuns(Duration.ofMillis(EVICTION_PERIOD_IN_MILLIS)); > assertEquals(EVICTION_PERIOD_IN_MILLIS, > pool.getTimeBetweenEvictionRuns().toMillis()); > pool.addObject(); > try { > diff --git > a/src/test/java/org/apache/commons/pool2/impl/TestAbandonedKeyedObjectPool.java > b/src/test/java/org/apache/commons/pool2/impl/TestAbandonedKeyedObjectPool.java > index fb343f45..aa09ffb2 100644 > --- > a/src/test/java/org/apache/commons/pool2/impl/TestAbandonedKeyedObjectPool.java > +++ > b/src/test/java/org/apache/commons/pool2/impl/TestAbandonedKeyedObjectPool.java > @@ -205,7 +205,7 @@ public class TestAbandonedKeyedObjectPool { > final int n = 10; > pool.setMaxTotal(n); > pool.setBlockWhenExhausted(false); > - pool.setTimeBetweenEvictionRuns(Duration.ofMillis(250)); > + pool.setDurationBetweenEvictionRuns(Duration.ofMillis(250)); > PooledTestObject pooledObj = null; > final Integer key = 0; > for (int i = 0; i < 5; i++) { > diff --git > a/src/test/java/org/apache/commons/pool2/impl/TestAbandonedObjectPool.java > b/src/test/java/org/apache/commons/pool2/impl/TestAbandonedObjectPool.java > index 4fee6142..1f13de22 100644 > --- > a/src/test/java/org/apache/commons/pool2/impl/TestAbandonedObjectPool.java > +++ > b/src/test/java/org/apache/commons/pool2/impl/TestAbandonedObjectPool.java > @@ -286,7 +286,7 @@ public class TestAbandonedObjectPool { > final int n = 10; > pool.setMaxTotal(n); > pool.setBlockWhenExhausted(false); > - pool.setTimeBetweenEvictionRuns(Duration.ofMillis(500)); > + pool.setDurationBetweenEvictionRuns(Duration.ofMillis(500)); > PooledTestObject obj = null; > for (int i = 0; i < 5; i++) { > obj = pool.borrowObject(); > diff --git > a/src/test/java/org/apache/commons/pool2/impl/TestGenericKeyedObjectPool.java > b/src/test/java/org/apache/commons/pool2/impl/TestGenericKeyedObjectPool.java > index 23dc741f..ff24933a 100644 > --- > a/src/test/java/org/apache/commons/pool2/impl/TestGenericKeyedObjectPool.java > +++ > b/src/test/java/org/apache/commons/pool2/impl/TestGenericKeyedObjectPool.java > @@ -1426,6 +1426,7 @@ public class TestGenericKeyedObjectPool extends > AbstractTestKeyedObjectPool { > config.setMinIdlePerKey(minIdle); > config.setMaxTotal(maxTotal); > config.setMaxWait(maxWaitDuration); > + > config.setMinEvictableIdleDuration(Duration.ofMillis(minEvictableIdleTimeMillis)); > > > config.setMinEvictableIdleTime(Duration.ofMillis(minEvictableIdleTimeMillis)); > config.setNumTestsPerEvictionRun(numTestsPerEvictionRun); > config.setTestOnBorrow(testOnBorrow); > @@ -1463,7 +1464,7 @@ public class TestGenericKeyedObjectPool extends > AbstractTestKeyedObjectPool { > public void testContructorEvictionConfig() throws Exception { > final GenericKeyedObjectPoolConfig<String> config = new > GenericKeyedObjectPoolConfig<>(); > config.setTimeBetweenEvictionRuns(Duration.ofMillis(500)); > - config.setMinEvictableIdleTime(Duration.ofMillis(50)); > + config.setMinEvictableIdleDuration(Duration.ofMillis(50)); > config.setNumTestsPerEvictionRun(5); > try (final GenericKeyedObjectPool<String, String> p = new > GenericKeyedObjectPool<>(simpleFactory, config)) { > for (int i = 0; i < 5; i++) { > @@ -1501,7 +1502,7 @@ public class TestGenericKeyedObjectPool extends > AbstractTestKeyedObjectPool { > gkoPool.setMaxTotalPerKey(500); > gkoPool.setNumTestsPerEvictionRun(100); > gkoPool.setMinEvictableIdleTime(Duration.ofMillis(250)); > - gkoPool.setTimeBetweenEvictionRuns(Duration.ofMillis(500)); > + gkoPool.setDurationBetweenEvictionRuns(Duration.ofMillis(500)); > > final String[] active = new String[500]; > for(int i=0;i<500;i++) { > 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 01a1945b..521d7c54 100644 > --- > a/src/test/java/org/apache/commons/pool2/impl/TestGenericObjectPool.java > +++ > b/src/test/java/org/apache/commons/pool2/impl/TestGenericObjectPool.java > @@ -648,6 +648,7 @@ public class TestGenericObjectPool extends > TestBaseObjectPool { > > private void checkEvict(final boolean lifo) throws Exception { > // yea this is hairy but it tests all the code paths in > GOP.evict() > + > genericObjectPool.setSoftMinEvictableIdleDuration(Duration.ofMillis(10)); > genericObjectPool.setSoftMinEvictableIdle(Duration.ofMillis(10)); > > genericObjectPool.setSoftMinEvictableIdleTime(Duration.ofMillis(10)); > genericObjectPool.setMinIdle(2); > @@ -978,7 +979,7 @@ public class TestGenericObjectPool extends > TestBaseObjectPool { > final GenericObjectPoolConfig<String> config = new > GenericObjectPoolConfig<>(); > config.setJmxEnabled(false); > GenericObjectPool<String> abandoned = new > GenericObjectPool<>(simpleFactory, config); > - abandoned.setTimeBetweenEvictionRuns(Duration.ofMillis(100)); // > Starts evictor > + abandoned.setDurationBetweenEvictionRuns(Duration.ofMillis(100)); > // Starts evictor > assertEquals(abandoned.getRemoveAbandonedTimeout(), > abandoned.getRemoveAbandonedTimeoutDuration().getSeconds()); > > // This is ugly, but forces GC to hit the pool > @@ -1687,6 +1688,7 @@ public class TestGenericObjectPool extends > TestBaseObjectPool { > timePool.setMaxIdle(5); > timePool.setMaxTotal(5); > timePool.setNumTestsPerEvictionRun(5); > + timePool.setMinEvictableIdleDuration(Duration.ofSeconds(3)); > timePool.setMinEvictableIdle(Duration.ofSeconds(3)); > timePool.setMinEvictableIdleTime(Duration.ofSeconds(3)); > > timePool.setSoftMinEvictableIdleTime(TestConstants.ONE_SECOND_DURATION); > @@ -2703,7 +2705,7 @@ public class TestGenericObjectPool extends > TestBaseObjectPool { > expected.setMaxTotal(2); > expected.setMaxIdle(3); > expected.setMaxWait(Duration.ofMillis(5)); > - expected.setMinEvictableIdleTime(Duration.ofMillis(7L)); > + expected.setMinEvictableIdleDuration(Duration.ofMillis(7L)); > expected.setNumTestsPerEvictionRun(9); > expected.setTestOnCreate(true); > expected.setTestOnBorrow(true); > diff --git > a/src/test/java/org/apache/commons/pool2/impl/TestGenericObjectPoolClassLoaders.java > b/src/test/java/org/apache/commons/pool2/impl/TestGenericObjectPoolClassLoaders.java > index 4e40b358..851b741b 100644 > --- > a/src/test/java/org/apache/commons/pool2/impl/TestGenericObjectPoolClassLoaders.java > +++ > b/src/test/java/org/apache/commons/pool2/impl/TestGenericObjectPoolClassLoaders.java > @@ -83,7 +83,7 @@ public class TestGenericObjectPoolClassLoaders { > final CustomClassLoaderObjectFactory factory1 = new > CustomClassLoaderObjectFactory(1); > try (final GenericObjectPool<URL> pool1 = new > GenericObjectPool<>(factory1)) { > pool1.setMinIdle(1); > - pool1.setTimeBetweenEvictionRuns(Duration.ofMillis(100)); > + > pool1.setDurationBetweenEvictionRuns(Duration.ofMillis(100)); > int counter = 0; > while (counter < 50 && pool1.getNumIdle() != 1) { > Thread.sleep(100); > @@ -101,7 +101,7 @@ public class TestGenericObjectPoolClassLoaders { > assertEquals(1, pool2.getNumIdle(), "Wrong number > of idle objects in pool2"); > pool2.clear(); > > - > pool2.setTimeBetweenEvictionRuns(Duration.ofMillis(100)); > + > pool2.setDurationBetweenEvictionRuns(Duration.ofMillis(100)); > > counter = 0; > while (counter < 50 && pool2.getNumIdle() != 1) { > diff --git > a/src/test/java/org/apache/commons/pool2/impl/TestGenericObjectPoolFactoryCreateFailure.java > b/src/test/java/org/apache/commons/pool2/impl/TestGenericObjectPoolFactoryCreateFailure.java > index 6bb1b6f4..6d965414 100644 > --- > a/src/test/java/org/apache/commons/pool2/impl/TestGenericObjectPoolFactoryCreateFailure.java > +++ > b/src/test/java/org/apache/commons/pool2/impl/TestGenericObjectPoolFactoryCreateFailure.java > @@ -110,7 +110,8 @@ public class TestGenericObjectPoolFactoryCreateFailure > { > config.setTestWhileIdle(false); > config.setTimeBetweenEvictionRuns(NEG_ONE_DURATION); > config.setMinEvictableIdleTime(NEG_ONE_DURATION); > - config.setSoftMinEvictableIdleTime(NEG_ONE_DURATION); > + config.setMinEvictableIdleDuration(NEG_ONE_DURATION); > + config.setSoftMinEvictableIdleDuration(NEG_ONE_DURATION); > > config.setMaxWait(NEG_ONE_DURATION); > try (GenericObjectPool<Object> pool = new > GenericObjectPool<>(factory, config)) { > >