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
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
getOrCreate
(PoolMap.PoolResourceSupplier<R> supplier) boolean
int
size()
values()
-
Field Details
-
resources
-
maxSize
-
nextIndex
-
-
Constructor Details
-
RoundRobinPool
-
-
Method Details
-
getOrCreate
- Specified by:
getOrCreate
in interfacePoolMap.Pool<R>
- Throws:
IOException
-
remove
- Specified by:
remove
in interfacePoolMap.Pool<R>
-
clear
- Specified by:
clear
in interfacePoolMap.Pool<R>
-
values
- Specified by:
values
in interfacePoolMap.Pool<R>
-
size
- Specified by:
size
in interfacePoolMap.Pool<R>
-