catch
(Exception e) { // invalidate the object
pool.invalidateObject(key, obj); // do not return the object to the pool twice
obj = null
; } finally
{ // make sure the object is returned to the pool
if
(null
!= obj) { pool.returnObject(key, obj); } } {@link KeyedObjectPool} implementations may choose to store at mostone instance per key value, or may choose to maintain a pool of instances for each key (essentially creating a {@link java.util.Map Map} of{@link ObjectPool pools}).
See {@link BaseKeyedObjectPool} for a simple base implementation.
@author Rodney Waldhoff @author Sandy McArthur @version $Revision: 962893 $ $Date: 2010-07-10 13:37:27 -0400 (Sat, 10 Jul 2010) $ @see KeyedPoolableObjectFactory @see KeyedObjectPoolFactory @see ObjectPool @see BaseKeyedObjectPool @since Pool 1.0
|
|
|
|
|
|
|
|