PoolUtils.erodingPool
- ObjectPool!(T) erodingPool(ObjectPool!(T) pool)
- ObjectPool!(T) erodingPool(ObjectPool!(T) pool, float factor)
- KeyedObjectPool!(K, V) erodingPool(KeyedObjectPool!(K, V) keyedPool)
- KeyedObjectPool!(K, V) erodingPool(KeyedObjectPool!(K, V) keyedPool, float factor)
- KeyedObjectPool!(K, V) erodingPool(KeyedObjectPool!(K, V) keyedPool, float factor, bool perKey)
class PoolUtils
static
KeyedObjectPool!(K, V)
erodingPool
hunt pool PoolUtils PoolUtils
constructorsstatic functions
Returns a pool that adaptively decreases its size when idle objects are no longer needed. This is intended as an always thread-safe alternative to using an idle object evictor provided by many pool implementations. This is also an effective way to shrink FIFO ordered pools that experience load spikes. <p> The factor parameter provides a mechanism to tweak the rate at which the pool tries to shrink its size. Values between 0 and 1 cause the pool to try to shrink its size more often. Values greater than 1 cause the pool to less frequently try to shrink its size. </p> <p> The perKey parameter determines if the pool shrinks on a whole pool basis or a per key basis. When perKey is false, the keys do not have an effect on the rate at which the pool tries to shrink its size. When perKey is true, each key is shrunk independently. </p>
@param keyedPool the KeyedObjectPool to be decorated so it shrinks its idle count when possible. @param factor a positive value to scale the rate at which the pool tries to reduce its size. If 0 < factor < 1 then the pool shrinks more aggressively. If 1 < factor then the pool shrinks less aggressively. @param perKey when true, each key is treated independently. @param <K> the type of the pool key @param <V> the type of pool entries @return a pool that adaptively decreases its size when idle objects are no longer needed. @see #erodingPool(KeyedObjectPool) @see #erodingPool(KeyedObjectPool, float)