Package org.apache.commons.pool2
Class PoolUtils.ErodingPerKeyKeyedObjectPool<K,V>
- java.lang.Object
-
- org.apache.commons.pool2.PoolUtils.ErodingKeyedObjectPool<K,V>
-
- org.apache.commons.pool2.PoolUtils.ErodingPerKeyKeyedObjectPool<K,V>
-
- All Implemented Interfaces:
KeyedObjectPool<K,V>
- Enclosing class:
- PoolUtils
private static class PoolUtils.ErodingPerKeyKeyedObjectPool<K,V> extends PoolUtils.ErodingKeyedObjectPool<K,V>
Extends ErodingKeyedObjectPool to allow erosion to take place on a per-key basis. Timing of erosion events is tracked separately for separate keyed pools.
-
-
Field Summary
Fields Modifier and Type Field Description private floatfactorErosion factor - same for all poolsprivate java.util.Map<K,PoolUtils.ErodingFactor>factorsMap of ErodingFactor instances keyed on pool keys
-
Constructor Summary
Constructors Constructor Description ErodingPerKeyKeyedObjectPool(KeyedObjectPool<K,V> keyedPool, float factor)Create a new ErordingPerKeyKeyedObjectPool decorating the given keyed pool with the specified erosion factor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected PoolUtils.ErodingFactorgetErodingFactor(K key)Returns the eroding factor for the given keyjava.lang.StringtoString()-
Methods inherited from class org.apache.commons.pool2.PoolUtils.ErodingKeyedObjectPool
addObject, borrowObject, clear, clear, close, getKeyedPool, getNumActive, getNumActive, getNumIdle, getNumIdle, invalidateObject, returnObject
-
-
-
-
Field Detail
-
factor
private final float factor
Erosion factor - same for all pools
-
factors
private final java.util.Map<K,PoolUtils.ErodingFactor> factors
Map of ErodingFactor instances keyed on pool keys
-
-
Constructor Detail
-
ErodingPerKeyKeyedObjectPool
public ErodingPerKeyKeyedObjectPool(KeyedObjectPool<K,V> keyedPool, float factor)
Create a new ErordingPerKeyKeyedObjectPool decorating the given keyed pool with the specified erosion factor.- Parameters:
keyedPool- underlying keyed poolfactor- erosion factor
-
-
Method Detail
-
getErodingFactor
protected PoolUtils.ErodingFactor getErodingFactor(K key)
Returns the eroding factor for the given key- Overrides:
getErodingFactorin classPoolUtils.ErodingKeyedObjectPool<K,V>- Parameters:
key- key- Returns:
- eroding factor for the given keyed pool
-
toString
public java.lang.String toString()
- Overrides:
toStringin classPoolUtils.ErodingKeyedObjectPool<K,V>
-
-