Package org.apache.hadoop.hbase.util
Class PoolMap.RoundRobinPool<R>
java.lang.Object
org.apache.hadoop.hbase.util.PoolMap.RoundRobinPool<R>
- Type Parameters:
R- the type of the resource
- All Implemented Interfaces:
PoolMap.Pool<R>
The
RoundRobinPool represents a PoolMap.Pool, which stores its resources
in an ArrayList. It load-balances access to its resources by returning a different
resource every time a given key is looked up.
If maxSize is set to Integer.MAX_VALUE, then the size of the pool is
unbounded. Otherwise, it caps the number of resources in this pool to the (non-zero positive)
value specified in maxSize.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()getOrCreate(PoolMap.PoolResourceSupplier<R> supplier) booleanintsize()values()
-
Field Details
-
resources
-
maxSize
-
nextIndex
-
-
Constructor Details
-
RoundRobinPool
-
-
Method Details
-
getOrCreate
- Specified by:
getOrCreatein interfacePoolMap.Pool<R>- Throws:
IOException
-
remove
- Specified by:
removein interfacePoolMap.Pool<R>
-
clear
- Specified by:
clearin interfacePoolMap.Pool<R>
-
values
- Specified by:
valuesin interfacePoolMap.Pool<R>
-
size
- Specified by:
sizein interfacePoolMap.Pool<R>
-