Package org.apache.hadoop.hbase.util
Class WeakObjectPool<K,V>
java.lang.Object
org.apache.hadoop.hbase.util.ObjectPool<K,V>
org.apache.hadoop.hbase.util.WeakObjectPool<K,V>
A
WeakReference based shared object pool. The objects are kept in weak references and
associated with keys which are identified by the equals method. The objects are created
by ObjectPool.ObjectFactory on demand. The object creation
is expected to be lightweight, and the objects may be excessively created and discarded. Thread
safe.-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class org.apache.hadoop.hbase.util.ObjectPool
ObjectPool.ObjectFactory<K,V> -
Field Summary
Fields inherited from class org.apache.hadoop.hbase.util.ObjectPool
DEFAULT_CONCURRENCY_LEVEL, DEFAULT_INITIAL_CAPACITY, referenceCache, staleRefQueue -
Constructor Summary
ConstructorsConstructorDescriptionWeakObjectPool(ObjectPool.ObjectFactory<K, V> objectFactory) WeakObjectPool(ObjectPool.ObjectFactory<K, V> objectFactory, int initialCapacity) WeakObjectPool(ObjectPool.ObjectFactory<K, V> objectFactory, int initialCapacity, int concurrencyLevel) -
Method Summary
Modifier and TypeMethodDescriptioncreateReference(K key, V obj) Create a reference associated with the given objectgetReferenceKey(Reference<V> ref) Get key of the given referenceMethods inherited from class org.apache.hadoop.hbase.util.ObjectPool
get, purge, size
-
Constructor Details
-
WeakObjectPool
-
WeakObjectPool
-
WeakObjectPool
public WeakObjectPool(ObjectPool.ObjectFactory<K, V> objectFactory, int initialCapacity, int concurrencyLevel)
-
-
Method Details
-
createReference
Description copied from class:ObjectPoolCreate a reference associated with the given object- Specified by:
createReferencein classObjectPool<K,V> - Parameters:
key- the key to store in the referenceobj- the object to associate with- Returns:
- the reference instance
-
getReferenceKey
Description copied from class:ObjectPoolGet key of the given reference- Specified by:
getReferenceKeyin classObjectPool<K,V> - Parameters:
ref- The reference- Returns:
- key of the reference
-