org.apache.hadoop.hbase.util
Class PoolMap.ReusablePool<R>

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractQueue<E>
          extended by java.util.concurrent.ConcurrentLinkedQueue<R>
              extended by 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

Constructor Summary
PoolMap.ReusablePool(int maxSize)
           
 
Method Summary
 R get()
           
 R put(R resource)
           
 Collection<R> values()
           
 
Methods inherited from class java.util.concurrent.ConcurrentLinkedQueue
add, contains, isEmpty, iterator, offer, peek, poll, remove, size, toArray, toArray
 
Methods inherited from class java.util.AbstractQueue
addAll, clear, element, remove
 
Methods inherited from class java.util.AbstractCollection
containsAll, removeAll, retainAll, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.hadoop.hbase.util.PoolMap.Pool
clear, remove, size
 
Methods inherited from interface java.util.Queue
element, remove
 
Methods inherited from interface java.util.Collection
addAll, clear, containsAll, equals, hashCode, removeAll, retainAll
 

Constructor Detail

PoolMap.ReusablePool

public PoolMap.ReusablePool(int maxSize)
Method Detail

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.