@Override
    public R getOrCreate(PoolResourceSupplier<R> supplier) throws IOException {
      int size = resources.size();
      R resource;

      /* letting pool to grow */
      if (size < maxSize) {
        resource = createResource(supplier);
        resources.add(resource);
      } else {
        resource = resources.get(nextIndex);

        /* at this point size cannot be 0 */
        nextIndex = (nextIndex + 1) % size;
      }

      return resource;
    }
The <code>RoundRobinPool</code> represents a {@link PoolMap.Pool}, which stores its resources
in an {@link ArrayList}. It load-balances access to its resources by returning a different
resource every time a given key is looked up.
<p>
If {@link #maxSize} is set to {@link 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 {@link #maxSize}.
</p>
@param <R> the type of the resource
hbase-client/src/main/java/org/apache/hadoop/hbase/util/PoolMap.java