Obtains an instance from this pool for the specified <code>key</code>.
<p>
Instances returned from this method will have been either newly created
with {@link KeyedPooledObjectFactory#makeObject makeObject} or will be
a previously idle object and have been activated with
{@link KeyedPooledObjectFactory#activateObject activateObject} and then
(optionally) validated with
{@link KeyedPooledObjectFactory#validateObject validateObject}.
</p>
<p>
By contract, clients <strong>must</strong> return the borrowed object
using {@link #returnObject returnObject},
{@link #invalidateObject invalidateObject}, or a related method as
defined in an implementation or sub-interface, using a <code>key</code>
that is {@link Object#equals equivalent} to the one used to borrow the
instance in the first place.
</p>
<p>
The behaviour of this method when the pool has been exhausted is not
strictly specified (although it may be specified by implementations).
</p>
@param key the key used to obtain the object
@return an instance from this pool.
@throws IllegalStateException
after {@link #close close} has been called on this pool
@throws Exception
when {@link KeyedPooledObjectFactory#makeObject
makeObject}exception
@throws NoSuchElementException
when the pool is exhausted and cannot or will not return
another instance
Obtains an instance from this pool for the specified <code>key</code>. <p> Instances returned from this method will have been either newly created with {@link KeyedPooledObjectFactory#makeObject makeObject} or will be a previously idle object and have been activated with {@link KeyedPooledObjectFactory#activateObject activateObject} and then (optionally) validated with {@link KeyedPooledObjectFactory#validateObject validateObject}. </p> <p> By contract, clients <strong>must</strong> return the borrowed object using {@link #returnObject returnObject}, {@link #invalidateObject invalidateObject}, or a related method as defined in an implementation or sub-interface, using a <code>key</code> that is {@link Object#equals equivalent} to the one used to borrow the instance in the first place. </p> <p> The behaviour of this method when the pool has been exhausted is not strictly specified (although it may be specified by implementations). </p>
@param key the key used to obtain the object
@return an instance from this pool.
@throws IllegalStateException after {@link #close close} has been called on this pool @throws Exception when {@link KeyedPooledObjectFactory#makeObject makeObject}exception @throws NoSuchElementException when the pool is exhausted and cannot or will not return another instance