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.Config
DEFAULT_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, startEvictor
assertOpen, isClosed
public AbandonedObjectPool(PoolableObjectFactory factory, AbandonedConfig config)
factory
- PoolableObjectFactory used to create thisconfig
- configuration for abandoned db connectionspublic Object borrowObject() throws Exception
borrowObject
in interface ObjectPool
borrowObject
in class GenericObjectPool
Exception
- if an exception occurs retrieving a
connection from the poolpublic void returnObject(Object obj) throws Exception
returnObject
in interface ObjectPool
returnObject
in class GenericObjectPool
obj
- db Connection to returnException
- if an exception occurs returning the connection
to the poolpublic void invalidateObject(Object obj) throws Exception
invalidateObject
in interface ObjectPool
invalidateObject
in class GenericObjectPool
obj
- object to be returnedException
- if an exception occurs invalidating the objectCopyright © 2015. All rights reserved.