org.apache.hadoop.hbase.util
Class PoolMap.ReusablePool<R>
java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractQueue<E>
java.util.concurrent.ConcurrentLinkedQueue<R>
org.apache.hadoop.hbase.util.PoolMap.ReusablePool<R>
- Type Parameters:
R - the type of the resource
- All Implemented Interfaces:
- Serializable, Iterable<R>, Collection<R>, Queue<R>, PoolMap.Pool<R>
- Enclosing class:
- PoolMap<K,V>
public class PoolMap.ReusablePool<R>
- extends ConcurrentLinkedQueue<R>
- implements PoolMap.Pool<R>
The ReusablePool represents a PoolMap.Pool that builds
on the LinkedList class. It essentially allows resources to be
checked out, at which point it is removed from this pool. When the resource
is no longer required, it should be returned to the pool in order to be
reused.
If maxSize is set to Integer.MAX_VALUE, then the size of
the pool is unbounded. Otherwise, it caps the number of consumers that can
check out a resource from this pool to the (non-zero positive) value
specified in maxSize.
- See Also:
- Serialized Form
| Methods inherited from class java.util.concurrent.ConcurrentLinkedQueue |
add, contains, isEmpty, iterator, offer, peek, poll, remove, size, toArray, toArray |
PoolMap.ReusablePool
public PoolMap.ReusablePool(int maxSize)
get
public R get()
- Specified by:
get in interface PoolMap.Pool<R>
put
public R put(R resource)
- Specified by:
put in interface PoolMap.Pool<R>
values
public Collection<R> values()
- Specified by:
values in interface PoolMap.Pool<R>
Copyright © 2013 The Apache Software Foundation. All Rights Reserved.