Javadoc
An Elastic Pool is an object pool that can dynamically grow.
Normally, an element is obtained by a client and then returned to the pool
after use. However, if the element gets into a bad state, the element can
be discarded, based upon the recycle() method returning false. This will
cause the element to be removed from the pool, and for a subsequent request,
a new element can be created on the fly to replace the discarded one.
The pool starts with zero (active) elements. Every time a client attempts
to obtain an element, an element from the pool is returned if available.
Otherwise, if the number of active elements is less than the pool's limit,
a new element is created (using abstract method create(), this must be
overridden by all implementations), and the number of active elements is
increased by one. If the limit is reached, then obtain() blocks until
either an element is returned to the pool or, if the obtain method with timeout
parameters is used, a timeout occurs.
Every time an element is returned to the pool, it is "recycled" to restore its
fresh state for the next use or destroyed, depending on its state.