EvictionPolicy (Apache Commons Pool 2.11.1 API)

org.apache.commons.pool2.impl

## Interface EvictionPolicy<T>

- Type Parameters:
    `T` - the type of objects in the pool
  All Known Implementing Classes:
    DefaultEvictionPolicy

      public interface EvictionPolicy<T>

  To provide a custom eviction policy (i.e. something other than `DefaultEvictionPolicy` for a pool, users must provide an implementation of this interface that provides the required eviction policy.
  Since:
    2.0

- - ### Method Summary

    All Methods Instance Methods Abstract 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.

- - ### Method Detail

    - #### evict

          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.
      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–2021 The Apache Software Foundation. All rights reserved.