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
Modifier and TypeClassDescriptionprotected static interface
static interface
static enum
(package private) static class
(package private) static class
-
Field Summary
Modifier and TypeFieldDescriptionprivate final int
private final Map<K,
PoolMap.Pool<V>> private final PoolMap.PoolType
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
protected PoolMap.Pool<V>
protected static <V> V
createResource
(PoolMap.PoolResourceSupplier<V> supplier) getOrCreate
(K key, PoolMap.PoolResourceSupplier<V> supplier) boolean
values()
-
Field Details
-
pools
-
poolType
-
poolMaxSize
-
-
Constructor Details
-
PoolMap
-
-
Method Details
-
getOrCreate
- Throws:
IOException
-
remove
-
values
-
clear
-
createResource
- Throws:
IOException
-
createPool
-