Returns an object to a keyed pool.
For the pool to function correctly, the object instance must have been borrowed from the pool (under the same key) and not yet returned. Repeated returnObject
calls on the same object/key pair (with no borrowObject
calls in between) will result in multiple references to the object in the idle instance pool.
If {@link #getMaxIdle() maxIdle} is set to a positive value and the number of idle instances under the givenkey has reached this value, the returning instance is destroyed.
If {@link #getTestOnReturn() testOnReturn} == true, the returning instance is validated before being returnedto the idle instance pool under the given key. In this case, if validation fails, the instance is destroyed.
@param key pool key @param obj instance to return to the keyed pool @throws ExceptionReturns an object instance to the pool.
If {@link #getMaxIdle() maxIdle} is set to a positive value and the number of idle instanceshas reached this value, the returning instance is destroyed.
If {@link #getTestOnReturn() testOnReturn} == true, the returning instance is validated before being returnedto the idle instance pool. In this case, if validation fails, the instance is destroyed.
Note: There is no guard to prevent an object being returned to the pool multiple times. Clients are expected to discard references to returned objects and ensure that an object is not returned to the pool multiple times in sequence (i.e., without being borrowed again between returns). Violating this contract will result in the same object appearing multiple times in the pool and pool counters (numActive, numIdle) returning incorrect values.
@param obj instance to return to the pool
|
|
|
|
|
|
|
|