K
- the type of the key to the resourceV
- the type of the resource being pooled@InterfaceAudience.Private public class PoolMap<K,V> extends Object implements Map<K,V>
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.
Modifier and Type | Class and Description |
---|---|
protected static interface |
PoolMap.Pool<R> |
static class |
PoolMap.PoolType |
static class |
PoolMap.ReusablePool<R>
|
Constructor and Description |
---|
PoolMap(PoolMap.PoolType poolType) |
PoolMap(PoolMap.PoolType poolType,
int poolMaxSize) |
Modifier and Type | Method and Description |
---|---|
void |
clear() |
boolean |
containsKey(Object key) |
boolean |
containsValue(Object value) |
protected PoolMap.Pool<V> |
createPool() |
Set<Map.Entry<K,V>> |
entrySet() |
V |
get(Object key) |
boolean |
isEmpty() |
Set<K> |
keySet() |
V |
put(K key,
V value) |
void |
putAll(Map<? extends K,? extends V> map) |
V |
remove(Object key) |
boolean |
removeValue(K key,
V value) |
int |
size() |
int |
size(K key) |
Collection<V> |
values() |
Collection<V> |
values(K key) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
compute, computeIfAbsent, computeIfPresent, equals, forEach, getOrDefault, hashCode, merge, putIfAbsent, remove, replace, replace, replaceAll
public PoolMap(PoolMap.PoolType poolType)
public PoolMap(PoolMap.PoolType poolType, int poolMaxSize)
public Collection<V> values(K key)
public int size(K key)
public boolean containsKey(Object key)
containsKey
in interface Map<K,V>
public boolean containsValue(Object value)
containsValue
in interface Map<K,V>
protected PoolMap.Pool<V> createPool()
Copyright © 2007–2019 Cloudera. All rights reserved.