public class AbandonedObjectPool extends GenericObjectPool
An implementation of a Jakarta-Commons ObjectPool which tracks JDBC connections and can recover abandoned db connections. If logAbandoned=true, a stack trace will be printed for any abandoned db connections recovered.
GenericObjectPool.ConfigDEFAULT_LIFO, DEFAULT_MAX_ACTIVE, DEFAULT_MAX_IDLE, DEFAULT_MAX_WAIT, DEFAULT_MIN_EVICTABLE_IDLE_TIME_MILLIS, DEFAULT_MIN_IDLE, DEFAULT_NUM_TESTS_PER_EVICTION_RUN, DEFAULT_SOFT_MIN_EVICTABLE_IDLE_TIME_MILLIS, DEFAULT_TEST_ON_BORROW, DEFAULT_TEST_ON_RETURN, DEFAULT_TEST_WHILE_IDLE, DEFAULT_TIME_BETWEEN_EVICTION_RUNS_MILLIS, DEFAULT_WHEN_EXHAUSTED_ACTION, WHEN_EXHAUSTED_BLOCK, WHEN_EXHAUSTED_FAIL, WHEN_EXHAUSTED_GROW| Constructor and Description |
|---|
AbandonedObjectPool(PoolableObjectFactory factory,
AbandonedConfig config)
Create an ObjectPool which tracks db connections.
|
| Modifier and Type | Method and Description |
|---|---|
Object |
borrowObject()
Get a db connection from the pool.
|
void |
invalidateObject(Object obj)
Invalidates an object from the pool.
|
void |
returnObject(Object obj)
Return a db connection to the pool.
|
addObject, clear, close, evict, getLifo, getMaxActive, getMaxIdle, getMaxWait, getMinEvictableIdleTimeMillis, getMinIdle, getNumActive, getNumIdle, getNumTestsPerEvictionRun, getSoftMinEvictableIdleTimeMillis, getTestOnBorrow, getTestOnReturn, getTestWhileIdle, getTimeBetweenEvictionRunsMillis, getWhenExhaustedAction, setConfig, setFactory, setLifo, setMaxActive, setMaxIdle, setMaxWait, setMinEvictableIdleTimeMillis, setMinIdle, setNumTestsPerEvictionRun, setSoftMinEvictableIdleTimeMillis, setTestOnBorrow, setTestOnReturn, setTestWhileIdle, setTimeBetweenEvictionRunsMillis, setWhenExhaustedAction, startEvictorassertOpen, isClosedpublic AbandonedObjectPool(PoolableObjectFactory factory, AbandonedConfig config)
factory - PoolableObjectFactory used to create thisconfig - configuration for abandoned db connectionspublic Object borrowObject() throws Exception
borrowObject in interface ObjectPoolborrowObject in class GenericObjectPoolException - if an exception occurs retrieving a
connection from the poolpublic void returnObject(Object obj) throws Exception
returnObject in interface ObjectPoolreturnObject in class GenericObjectPoolobj - db Connection to returnException - if an exception occurs returning the connection
to the poolpublic void invalidateObject(Object obj) throws Exception
invalidateObject in interface ObjectPoolinvalidateObject in class GenericObjectPoolobj - object to be returnedException - if an exception occurs invalidating the objectCopyright © 2017. All rights reserved.