Top Description Inners Fields Constructors Methods
org.apache.commons.pool2.impl

public abstract Class BaseGenericObjectPool<T>

extends BaseObject
implements AutoCloseable
Class Inheritance
All Implemented Interfaces
java.lang.AutoCloseable
Known Direct Subclasses
org.apache.commons.pool2.impl.GenericKeyedObjectPool, org.apache.commons.pool2.impl.GenericObjectPool
Type Parameters
<T>
Type of element pooled in this pool.
Imports
java.io.PrintWriter, .StringWriter, .Writer, java.lang.management.ManagementFactory, java.lang.ref.WeakReference, java.lang.reflect.InvocationTargetException, java.time.Duration, .Instant, java.util.ArrayList, .Arrays, .Deque, .Iterator, .List, .Map, .TimerTask, java.util.concurrent.ScheduledFuture, java.util.concurrent.atomic.AtomicLong, .AtomicReference, java.util.stream.Collectors, javax.management.InstanceAlreadyExistsException, .InstanceNotFoundException, .MBeanRegistrationException, .MBeanServer, .MalformedObjectNameException, .NotCompliantMBeanException, .ObjectName, org.apache.commons.pool2.BaseObject, .PooledObject, .PooledObjectState, .SwallowedExceptionListener

Base class that provides common functionality for GenericObjectPool and GenericKeyedObjectPool. The primary reason this class exists is reduce code duplication between the two pool implementations.

Concrete implementations of this class are expected to be thread-safe.

Since
2.0

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv class
BaseGenericObjectPool.EvictionIterator

The idle object eviction iterator.

pack-priv class
BaseGenericObjectPool.Evictor

The idle object evictor TimerTask.

pack-priv static class
BaseGenericObjectPool.IdentityWrapper<
type of objects in the pool
T
>

Wrapper for objects under management by the pool.

private static class
BaseGenericObjectPool.StatsStore

Maintains a cache of values for a single metric and reports statistics on the cached values.

Field Summary

Modifier and TypeField and Description
protected volatile AbandonedConfig
abandonedConfig

Additional configuration properties for abandoned object tracking.

private final BaseGenericObjectPool.StatsStore
private volatile boolean
private final AtomicLong
pack-priv volatile boolean
pack-priv final Object
private volatile boolean
pack-priv final AtomicLong
private final String
private static final Duration
pack-priv final AtomicLong
pack-priv final AtomicLong
pack-priv final AtomicLong
private volatile Duration
private static final String
pack-priv BaseGenericObjectPool<T>.EvictionIterator
pack-priv final Object
private volatile EvictionPolicy<T>
private BaseGenericObjectPool<T>.Evictor
private volatile Duration
private final WeakReference<ClassLoader>
factoryClassLoader

Class loader for evictor thread to use since, in a JavaEE or similar environment, the context class loader for the evictor thread may not have visibility of the correct factory.

private final boolean
private final BaseGenericObjectPool.StatsStore
private volatile boolean
private final AtomicReference<Duration>
private volatile int
private volatile Duration
public static final int
MEAN_TIMING_STATS_CACHE_SIZE

The size of the caches used to store historical data for some attributes so that rolling means may be calculated.

private volatile boolean
private volatile Duration
private volatile int
private final ObjectName
private final AtomicLong
private volatile Duration
private volatile SwallowedExceptionListener
private volatile boolean
private volatile boolean
private volatile boolean
private volatile boolean
private final BaseGenericObjectPool.StatsStore

Constructor Summary

AccessConstructor and Description
public
BaseGenericObjectPool(final BaseObjectPoolConfig<T>
Pool configuration
config
,
final String
The default base JMX name for the new pool unless overridden by the config
jmxNameBase
,
final String
Prefix to be used for JMX name for the new pool
jmxNamePrefix
)

Handles JMX registration (if required) and the initialization required for monitoring.

Method Summary

Modifier and TypeMethod and Description
pack-priv String

Returns:

The root string plus statistics.
appendStats
(final String
The root string.
string
)

Appends statistics if enabled.

pack-priv final void
assertOpen()

Verifies that the pool is open.

public abstract void
close()

Redeclares java.lang.AutoCloseable.close.

Closes the pool, destroys the remaining idle objects and, if registered in JMX, deregisters it.

pack-priv ArrayList<PooledObject<T>>

Returns:

a list of pooled objects to remove based on their state.
createRemoveList
(final AbandonedConfig
The abandoned configuration.
abandonedConfig
,
final Map<BaseGenericObjectPool.IdentityWrapper<T>, PooledObject<T>>
PooledObject instances to consider.
allObjects
)

Creates a list of pooled objects to remove based on their state.

pack-priv final Duration

Returns:

the duration since the given start time
durationSince
(final Instant
the start time
startInstant
)

Returns the duration since the given start time.

pack-priv abstract void
ensureMinIdle()

Tries to ensure that the configured minimum number of idle instances are available in the pool.

public abstract void
evict()

Perform numTests idle object eviction tests, evicting examined objects that meet the criteria for eviction.

public final boolean

Returns:

true if borrowObject() should block when the pool is exhausted
getBlockWhenExhausted
()

Gets whether to block when the borrowObject() method is invoked when the pool is exhausted (the maximum number of "active" objects has been reached).

public final long

Returns:

the borrowed object count
getBorrowedCount
()

Gets the total number of objects successfully borrowed from this pool over the lifetime of the pool.

public boolean

Returns:

true if detailed statistics collection is enabled, false if disabled for improved performance.
getCollectDetailedStatistics
()

Gets whether detailed timing statistics collection is enabled.

public final long

Returns:

the created object count
getCreatedCount
()

Gets the total number of objects created for this pool over the lifetime of the pool.

public final String

Returns:

pool creation stack trace
getCreationStackTrace
()

Gets the stack trace for the call that created this pool.

public final long

Returns:

validation destroyed object count
getDestroyedByBorrowValidationCount
()

Gets the total number of objects destroyed by this pool as a result of failing validation during borrowObject() over the lifetime of the pool.

public final long

Returns:

the evictor destroyed object count
getDestroyedByEvictorCount
()

Gets the total number of objects destroyed by the evictor associated with this pool over the lifetime of the pool.

public final long

Returns:

the destroyed object count
getDestroyedCount
()

Gets the total number of objects destroyed by this pool over the lifetime of the pool.

public final Duration

Returns:

number of milliseconds to sleep between evictor runs
getDurationBetweenEvictionRuns
()

Gets the duration to sleep between runs of the idle object evictor thread.

public EvictionPolicy<T>

Returns:

the eviction policy
getEvictionPolicy
()

Gets the EvictionPolicy defined for this pool.

public final String

Returns:

The fully qualified class name of the EvictionPolicy
getEvictionPolicyClassName
()

Gets the name of the EvictionPolicy implementation that is used by this pool.

public final Duration

Returns:

The timeout that will be used while waiting for the Evictor to shut down.
getEvictorShutdownTimeout
()

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.

public final Duration

Returns:

The timeout that will be used while waiting for the Evictor to shut down.
getEvictorShutdownTimeoutDuration
()

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.

public final long

Returns:

The timeout in milliseconds that will be used while waiting for the Evictor to shut down.
getEvictorShutdownTimeoutMillis
()

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.

public final boolean

Returns:

true if waiting threads are to be served by the pool in arrival order
getFairness
()

Gets whether or not the pool serves threads waiting to borrow objects fairly.

public final ObjectName

Returns:

the JMX name
getJmxName
()

Gets the name under which the pool has been registered with the platform MBean server or null if the pool has not been registered.

public final boolean

Returns:

true if the pool is configured with LIFO behavior or false if the pool is configured with FIFO behavior
getLifo
()

Gets 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.

public boolean

Returns:

true if abandoned object removal is configured for this pool and removal events are to be logged otherwise false
getLogAbandoned
()

Gets whether this pool identifies and logs any abandoned objects.

public final Duration

Returns:

maximum wait time in milliseconds since the pool was created
getMaxBorrowWaitDuration
()

Gets the maximum time a thread has waited to borrow objects from the pool.

public final long

Returns:

maximum wait time in milliseconds since the pool was created
getMaxBorrowWaitTimeMillis
()
Deprecated Use getMaxBorrowWaitDuration().

Gets the maximum time a thread has waited to borrow objects from the pool.

public final int

Returns:

the cap on the total number of object instances managed by the pool.
getMaxTotal
()

Gets the maximum number of objects that can be allocated by the pool (checked out to clients, or idle awaiting checkout) at a given time.

public final Duration

Returns:

the maximum number of milliseconds borrowObject() will block.
getMaxWaitDuration
()

Gets the maximum duration the borrowObject() method should block before throwing an exception when the pool is exhausted and getBlockWhenExhausted is true.

public final long

Returns:

the maximum number of milliseconds borrowObject() will block.
getMaxWaitMillis
()
Deprecated Use getMaxWaitDuration().

Gets the maximum amount of time (in milliseconds) the borrowObject() method should block before throwing an exception when the pool is exhausted and getBlockWhenExhausted is true.

public final Duration

Returns:

mean time an object has been checked out from the pool among recently returned objects.
getMeanActiveDuration
()

Gets the mean time objects are active for based on the last MEAN_TIMING_STATS_CACHE_SIZE objects returned to the pool.

public final long

Returns:

mean time an object has been checked out from the pool among recently returned objects.
getMeanActiveTimeMillis
()
Deprecated Use getMeanActiveDuration().

Gets the mean time objects are active for based on the last MEAN_TIMING_STATS_CACHE_SIZE objects returned to the pool.

public final Duration

Returns:

mean time in milliseconds that a recently served thread has had to wait to borrow an object from the pool.
getMeanBorrowWaitDuration
()

Gets the mean time threads wait to borrow an object based on the last MEAN_TIMING_STATS_CACHE_SIZE objects borrowed from the pool.

public final long

Returns:

mean time in milliseconds that a recently served thread has had to wait to borrow an object from the pool.
getMeanBorrowWaitTimeMillis
()
Deprecated Use getMeanBorrowWaitDuration().

Gets the mean time threads wait to borrow an object based on the last MEAN_TIMING_STATS_CACHE_SIZE objects borrowed from the pool.

public final Duration

Returns:

mean time an object has been idle in the pool among recently borrowed objects.
getMeanIdleDuration
()

Gets the mean time objects are idle for based on the last MEAN_TIMING_STATS_CACHE_SIZE objects borrowed from the pool.

public final long

Returns:

mean time an object has been idle in the pool among recently borrowed objects.
getMeanIdleTimeMillis
()
Deprecated Use getMeanIdleDuration().

Gets the mean time objects are idle for based on the last MEAN_TIMING_STATS_CACHE_SIZE objects borrowed from the pool.

public boolean

Returns:

whether to include statistics in exception messages.
getMessageStatistics
()

Gets whether to include statistics in exception messages.

public final Duration

Returns:

minimum amount of time an object may sit idle in the pool before it is eligible for eviction
getMinEvictableIdleDuration
()

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 setDurationBetweenEvictionRuns(Duration)).

public final Duration

Returns:

minimum amount of time an object may sit idle in the pool before it is eligible for eviction
getMinEvictableIdleTime
()

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 setDurationBetweenEvictionRuns(Duration)).

public final long

Returns:

minimum amount of time an object may sit idle in the pool before it is eligible for eviction
getMinEvictableIdleTimeMillis
()

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 setTimeBetweenEvictionRunsMillis(long)).

public abstract int

Returns:

count of instances available for checkout from the pool
getNumIdle
()

Gets the number of instances currently idle in this pool.

public final int

Returns:

max number of objects to examine during each evictor run
getNumTestsPerEvictionRun
()

Gets the maximum number of objects to examine during each run (if any) of the idle object evictor thread.

public boolean

Returns:

true if abandoned object removal is configured to be activated by borrowObject otherwise false
getRemoveAbandonedOnBorrow
()

Gets whether a check is made for abandoned objects when an object is borrowed from this pool.

public boolean

Returns:

true if abandoned object removal is configured to be activated when the evictor runs otherwise false
getRemoveAbandonedOnMaintenance
()

Gets whether a check is made for abandoned objects when the evictor runs.

public int

Returns:

The abandoned object timeout in seconds if abandoned object removal is configured for this pool; Integer.MAX_VALUE otherwise.
getRemoveAbandonedTimeout
()

Gets the timeout before which an object will be considered to be abandoned by this pool.

public Duration

Returns:

The abandoned object timeout in seconds if abandoned object removal is configured for this pool; Integer.MAX_VALUE otherwise.
getRemoveAbandonedTimeoutDuration
()

Gets the timeout before which an object will be considered to be abandoned by this pool.

public final long

Returns:

the returned object count
getReturnedCount
()

Gets the total number of objects returned to this pool over the lifetime of the pool.

public final Duration

Returns:

minimum amount of time an object may sit idle in the pool before it is eligible for eviction if minIdle instances are available
getSoftMinEvictableIdleDuration
()

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 setDurationBetweenEvictionRuns(Duration)), with the extra condition that at least minIdle object instances remain in the pool.

public final Duration

Returns:

minimum amount of time an object may sit idle in the pool before it is eligible for eviction if minIdle instances are available
getSoftMinEvictableIdleTime
()

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 setDurationBetweenEvictionRuns(Duration)), with the extra condition that at least minIdle object instances remain in the pool.

public final long

Returns:

minimum amount of time an object may sit idle in the pool before it is eligible for eviction if minIdle instances are available
getSoftMinEvictableIdleTimeMillis
()

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 setTimeBetweenEvictionRunsMillis(long)), with the extra condition that at least minIdle object instances remain in the pool.

private String

Returns:

exception stack trace as a string
getStackTrace
(final Exception
exception to trace
e
)

Gets the stack trace of an exception as a string.

pack-priv String

Returns:

a statistics string.
getStatsString
()

Gets a statistics string.

public final SwallowedExceptionListener

Returns:

The listener or null for no listener
getSwallowedExceptionListener
()

Gets the listener used (if any) to receive notifications of exceptions unavoidably swallowed by the pool.

public final boolean

Returns:

true if objects are validated before being returned from the borrowObject() method
getTestOnBorrow
()

Gets whether objects borrowed from the pool will be validated before being returned from the borrowObject() method.

public final boolean

Returns:

true if newly created objects are validated before being returned from the borrowObject() method
getTestOnCreate
()

Gets whether objects created for the pool will be validated before being returned from the borrowObject() method.

public final boolean

Returns:

true if objects are validated on return to the pool via the returnObject() method
getTestOnReturn
()

Gets whether objects borrowed from the pool will be validated when they are returned to the pool via the returnObject() method.

public final boolean

Returns:

true if objects will be validated by the evictor
getTestWhileIdle
()

Gets whether objects sitting idle in the pool will be validated by the idle object evictor (if any - see setDurationBetweenEvictionRuns(Duration)).

public final Duration

Returns:

number of milliseconds to sleep between evictor runs
getTimeBetweenEvictionRuns
()

Gets the duration to sleep between runs of the idle object evictor thread.

public final long

Returns:

number of milliseconds to sleep between evictor runs
getTimeBetweenEvictionRunsMillis
()

Gets the number of milliseconds to sleep between runs of the idle object evictor thread.

public boolean

Returns:

true if this pool is configured to detect and remove abandoned objects
isAbandonedConfig
()

Tests whether or not abandoned object removal is configured for this pool.

public final boolean

Returns:

true when this pool is closed.
isClosed
()

Tests whether this pool instance is closed.

private ObjectName

Returns:

registered ObjectName, null if registration fails
jmxRegister
(final BaseObjectPoolConfig<T>
Pool configuration
config
,
final String
default base JMX name for this pool
jmxNameBase
,
String
name prefix
jmxNamePrefix
)

Registers the pool with the platform MBean server.

pack-priv final void
jmxUnregister()

Unregisters this pool's MBean.

protected void
markReturningState(final PooledObject<T>
instance to return to the keyed pool
pooledObject
)

Marks the object as returning to the pool.

public void
setAbandonedConfig(final AbandonedConfig
the new configuration to use. This is used by value.
abandonedConfig
)

Sets the abandoned object removal configuration.

public final void
setBlockWhenExhausted(final boolean
true if borrowObject() should block when the pool is exhausted
blockWhenExhausted
)

Sets whether to block when the borrowObject() method is invoked when the pool is exhausted (the maximum number of "active" objects has been reached).

public void
setCollectDetailedStatistics(final boolean
whether to collect detailed statistics.
collectDetailedStatistics
)

Sets whether detailed timing statistics collection is enabled.

protected void
setConfig(final BaseObjectPoolConfig<T>
Initialization source.
config
)

Sets the receiver with the given configuration.

public final void
setDurationBetweenEvictionRuns(final Duration
duration to sleep between evictor runs
timeBetweenEvictionRuns
)

Sets the number of milliseconds to sleep between runs of the idle object evictor thread.

public void
setEvictionPolicy(final EvictionPolicy<T>
the eviction policy for this pool.
evictionPolicy
)

Sets the eviction policy for this pool.

private void
setEvictionPolicy(final String
Eviction policy class name.
className
,
final ClassLoader
Load the class from this class loader.
classLoader
)

Sets the eviction policy.

public final void
setEvictionPolicyClassName(final String
the fully qualified class name of the new eviction policy
evictionPolicyClassName
)

Sets the name of the EvictionPolicy implementation that is used by this pool.

public final void
setEvictionPolicyClassName(final String
the fully qualified class name of the new eviction policy
evictionPolicyClassName
,
final ClassLoader
the class loader to load the given evictionPolicyClassName.
classLoader
)

Sets the name of the EvictionPolicy implementation that is used by this pool.

public final void
setEvictorShutdownTimeout(final Duration
the timeout in milliseconds that will be used while waiting for the Evictor to shut down.
evictorShutdownTimeout
)

Sets 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 value for the Evictor.

public final void
setEvictorShutdownTimeoutMillis(final long
the timeout in milliseconds that will be used while waiting for the Evictor to shut down.
evictorShutdownTimeoutMillis
)

Sets 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 value for the Evictor.

public final void
setLifo(final boolean
true if the pool is to be configured with LIFO behavior or false if the pool is to be configured with FIFO behavior
lifo
)

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.

public final void
setMaxTotal(final int
The cap on the total number of object instances managed by the pool. Negative values mean that there is no limit to the number of objects allocated by the pool.
maxTotal
)

Sets the cap on the number of objects that can be allocated by the pool (checked out to clients, or idle awaiting checkout) at a given time.

public final void
setMaxWait(final Duration
the maximum duration borrowObject() will block or negative for indefinitely.
maxWaitDuration
)

Sets the maximum duration the borrowObject() method should block before throwing an exception when the pool is exhausted and getBlockWhenExhausted is true.

public final void
setMaxWaitMillis(final long
the maximum number of milliseconds borrowObject() will block or negative for indefinitely.
maxWaitMillis
)
Deprecated Use setMaxWait.

Sets the maximum amount of time (in milliseconds) the borrowObject() method should block before throwing an exception when the pool is exhausted and getBlockWhenExhausted is true.

public void
setMessagesStatistics(final boolean
whether to include statistics in exception messages.
messagesDetails
)

Sets whether to include statistics in exception messages.

public final void
setMinEvictableIdle(final Duration
minimum amount of time an object may sit idle in the pool before it is eligible for eviction
minEvictableIdleTime
)

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 setDurationBetweenEvictionRuns(Duration)).

public final void
setMinEvictableIdleDuration(final Duration
minimum amount of time an object may sit idle in the pool before it is eligible for eviction
minEvictableIdleTime
)

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 setDurationBetweenEvictionRuns(Duration)).

public final void
setMinEvictableIdleTime(final Duration
minimum amount of time an object may sit idle in the pool before it is eligible for eviction
minEvictableIdleTime
)

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 setDurationBetweenEvictionRuns(Duration)).

public final void
setMinEvictableIdleTimeMillis(final long
minimum amount of time an object may sit idle in the pool before it is eligible for eviction
minEvictableIdleTimeMillis
)

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 setTimeBetweenEvictionRunsMillis(long)).

public final void
setNumTestsPerEvictionRun(final int
max number of objects to examine during each evictor run
numTestsPerEvictionRun
)

Sets the maximum number of objects to examine during each run (if any) of the idle object evictor thread.

public final void
setSoftMinEvictableIdle(final Duration
minimum amount of time an object may sit idle in the pool before it is eligible for eviction if minIdle instances are available
softMinEvictableIdleTime
)

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 setDurationBetweenEvictionRuns(Duration)), with the extra condition that at least minIdle object instances remain in the pool.

public final void
setSoftMinEvictableIdleDuration(final Duration
minimum amount of time an object may sit idle in the pool before it is eligible for eviction if minIdle instances are available
softMinEvictableIdleTime
)

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 setDurationBetweenEvictionRuns(Duration)), with the extra condition that at least minIdle object instances remain in the pool.

public final void
setSoftMinEvictableIdleTime(final Duration
minimum amount of time an object may sit idle in the pool before it is eligible for eviction if minIdle instances are available
softMinEvictableIdleTime
)

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 setDurationBetweenEvictionRuns(Duration)), with the extra condition that at least minIdle object instances remain in the pool.

public final void
setSoftMinEvictableIdleTimeMillis(final long
minimum amount of time an object may sit idle in the pool before it is eligible for eviction if minIdle instances are available
softMinEvictableIdleTimeMillis
)

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 setTimeBetweenEvictionRunsMillis(long)), with the extra condition that at least minIdle object instances remain in the pool.

public final void
setSwallowedExceptionListener(final SwallowedExceptionListener
The listener or null for no listener
swallowedExceptionListener
)

Sets the listener used (if any) to receive notifications of exceptions unavoidably swallowed by the pool.

public final void
setTestOnBorrow(final boolean
true if objects should be validated before being returned from the borrowObject() method
testOnBorrow
)

Sets whether objects borrowed from the pool will be validated before being returned from the borrowObject() method.

public final void
setTestOnCreate(final boolean
true if newly created objects should be validated before being returned from the borrowObject() method
testOnCreate
)

Sets whether objects created for the pool will be validated before being returned from the borrowObject() method.

public final void
setTestOnReturn(final boolean
true if objects are validated on return to the pool via the returnObject() method
testOnReturn
)

Sets whether objects borrowed from the pool will be validated when they are returned to the pool via the returnObject() method.

public final void
setTestWhileIdle(final boolean
true so objects will be validated by the evictor
testWhileIdle
)

Sets whether objects sitting idle in the pool will be validated by the idle object evictor (if any - see setDurationBetweenEvictionRuns(Duration)).

public final void
setTimeBetweenEvictionRuns(final Duration
duration to sleep between evictor runs
timeBetweenEvictionRuns
)

Sets the number of milliseconds to sleep between runs of the idle object evictor thread.

public final void
setTimeBetweenEvictionRunsMillis(final long
number of milliseconds to sleep between evictor runs
timeBetweenEvictionRunsMillis
)

Sets the number of milliseconds to sleep between runs of the idle object evictor thread.

pack-priv final void
startEvictor(final Duration
time in milliseconds before start and between eviction runs
delay
)

Starts the evictor with the given delay.

pack-priv void
stopEvictor()

Stops the evictor.

pack-priv final void
swallowException(final Exception
exception to be swallowed
swallowException
)

Swallows an exception and notifies the configured listener for swallowed exceptions queue.

protected void
toStringAppendFields(final StringBuilder builder)

Overrides org.apache.commons.pool2.BaseObject.toStringAppendFields.

Used by sub-classes to include the fields defined by the sub-class in the toString() output.

pack-priv final void
updateStatsBorrow(final PooledObject<T>
object borrowed from the pool
p
,
final Duration
that the borrowing thread had to wait
waitDuration
)

Updates statistics after an object is borrowed from the pool.

pack-priv final void
updateStatsReturn(final Duration
the amount of time (in milliseconds) that the returning object was checked out
activeTime
)

Updates statistics after an object is returned to the pool.

pack-priv final void
wait(final Object
the object to wait on
obj
,
final Duration
the duration to wait
duration
)

Waits for notification on the given object for the specified duration.

Inherited from org.apache.commons.pool2.BaseObject:
toString