Class PoolUtils.ErodingPerKeyKeyedObjectPool<K,V>
java.lang.Object
org.apache.commons.pool.PoolUtils.ErodingKeyedObjectPool<K,V>
org.apache.commons.pool.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.
- Since:
- Pool 1.3
- Version:
- $Revision: 1222670 $ $Date: 2011-12-23 08:18:25 -0500 (Fri, 23 Dec 2011) $
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final floatErosion factor - same for all poolsprivate final Map<K, PoolUtils.ErodingFactor> Map of ErodingFactor instances keyed on pool keys -
Constructor Summary
ConstructorsConstructorDescriptionErodingPerKeyKeyedObjectPool(KeyedObjectPool<K, V> keyedPool, float factor) Create a new ErordingPerKeyKeyedObjectPool decorating the given keyed pool with the specified erosion factor. -
Method Summary
Modifier and TypeMethodDescriptionprotected PoolUtils.ErodingFactorgetErodingFactor(K key) Returns the eroding factor for the given keyprotected intReturns the total number of instances currently idle in this pool (optional operation).toString()Methods inherited from class PoolUtils.ErodingKeyedObjectPool
addObject, borrowObject, clear, clear, close, getKeyedPool, getNumActive, getNumActive, getNumIdle, getNumIdle, invalidateObject, returnObject, setFactory
-
Field Details
-
factor
private final float factorErosion factor - same for all pools -
factors
Map of ErodingFactor instances keyed on pool keys
-
-
Constructor Details
-
ErodingPerKeyKeyedObjectPool
Create a new ErordingPerKeyKeyedObjectPool decorating the given keyed pool with the specified erosion factor.- Parameters:
keyedPool- underlying keyed poolfactor- erosion factor
-
-
Method Details
-
numIdle
Returns the total number of instances currently idle in this pool (optional operation). Returns a negative value if this information is not available.- Overrides:
numIdlein classPoolUtils.ErodingKeyedObjectPool<K,V> - Parameters:
key- ignored- Returns:
- the total number of instances currently idle in this pool or a negative value if unsupported
-
getErodingFactor
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
- Overrides:
toStringin classPoolUtils.ErodingKeyedObjectPool<K,V>
-