org.apache.commons.pool2.impl

## Class DefaultEvictionPolicy<T>

- java.lang.Object
- - org.apache.commons.pool2.impl.DefaultEvictionPolicy<T>

- Type Parameters:
    `T` - the type of objects in the pool
  All Implemented Interfaces:
    EvictionPolicy<T>

      public class DefaultEvictionPolicy<T>
      extends Object
      implements EvictionPolicy<T>

  Provides the default implementation of `EvictionPolicy` used by the pools. Objects will be evicted if the following conditions are met:
  - the object has been idle longer than `BaseGenericObjectPool.getMinEvictableIdleTimeMillis()` / `BaseGenericObjectPool.getMinEvictableIdleTimeMillis()`
  - there are more than `GenericObjectPool.getMinIdle()` / `GenericKeyedObjectPoolConfig.getMinIdlePerKey()` idle objects in the pool and the object has been idle for longer than `BaseGenericObjectPool.getSoftMinEvictableIdleTimeMillis()` / `BaseGenericObjectPool.getSoftMinEvictableIdleTimeMillis()`
  This class is immutable and thread-safe.
  Since:
    2.0

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `DefaultEvictionPolicy()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `evict(EvictionConfig config, PooledObject<T> underTest, int idleCount)` This method is called to test if an idle object in the pool should be evicted or not.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### DefaultEvictionPolicy

          public DefaultEvictionPolicy()

  - ### Method Detail

    - #### evict

          public boolean evict(EvictionConfig config,
                               PooledObject<T> underTest,
                               int idleCount)

      Description copied from interface: `EvictionPolicy`
      This method is called to test if an idle object in the pool should be evicted or not.
      Specified by:
        `evict` in interface `EvictionPolicy<T>`
      Parameters:
        `config` - The pool configuration settings related to eviction
        `underTest` - The pooled object being tested for eviction
        `idleCount` - The current number of idle objects in the pool including the object under test
      Returns:
        `true` if the object should be evicted, otherwise `false`

Copyright © 2001–2017 The Apache Software Foundation. All rights reserved.