Package org.apache.hadoop.hbase.util
Class PoolMap<K,V>
java.lang.Object
org.apache.hadoop.hbase.util.PoolMap<K,V>
- Type Parameters:
K- the type of the key to the resourceV- the type of the resource being pooled
The
PoolMap maps a key to a collection of values, the elements of which are managed
by a pool. In effect, that collection acts as a shared pool of resources, access to which is
closely controlled as per the semantics of the pool.
In case the size of the pool is set to a non-zero positive number, that is used to cap the number
of resources that a pool may contain for any given key. A size of Integer.MAX_VALUE is
interpreted as an unbounded pool.
PoolMap is thread-safe. It does not remove elements automatically. Unused resources must be closed and removed explicitly.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static interfacestatic interfacestatic enum(package private) static class(package private) static class -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final intprivate final Map<K,PoolMap.Pool<V>> private final PoolMap.PoolType -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()protected PoolMap.Pool<V>protected static <V> VcreateResource(PoolMap.PoolResourceSupplier<V> supplier) getOrCreate(K key, PoolMap.PoolResourceSupplier<V> supplier) booleanvalues()
-
Field Details
-
pools
-
poolType
-
poolMaxSize
-
-
Constructor Details
-
PoolMap
-
-
Method Details
-
getOrCreate
- Throws:
IOException
-
remove
-
values
-
clear
-
createResource
- Throws:
IOException
-
createPool
-