int increaseCapacity(int expectedCapacity) {
            int newCapacity = elements.length;
            int maxCapacity = this.maxCapacity;
            do {
                newCapacity <<= 1;
            } while (newCapacity < expectedCapacity && newCapacity < maxCapacity);

            newCapacity = Math.min(newCapacity, maxCapacity);
            if (newCapacity != elements.length) {
                elements = Arrays.copyOf(elements, newCapacity);
            }

            return newCapacity;
        }
Light-weight object pool based on a thread-local stack.
<p/>
Forked from <a href="https://github.com/netty/netty">Netty</a>.

@param <T> the type of the pooled object
jraft-core/src/main/java/com/alipay/sofa/jraft/util/Recyclers.java