| org.apache.commons.pool.impl.GenericObjectPool
All known Subclasses: org.apache.commons.pool.impl.FairGenericObjectPool,
GenericObjectPool | public class GenericObjectPool extends BaseObjectPool implements ObjectPool(Code) | | A configurable
ObjectPool implementation.
When coupled with the appropriate
PoolableObjectFactory ,
GenericObjectPool provides robust pooling functionality for
arbitrary objects.
A GenericObjectPool provides a number of configurable parameters:
Optionally, one may configure the pool to examine and possibly evict objects as they
sit idle in the pool. This is performed by an "idle object eviction" thread, which
runs asychronously. The idle object eviction thread may be configured using the
following attributes:
-
GenericObjectPool.setTimeBetweenEvictionRunsMillis timeBetweenEvictionRunsMillis indicates how long the eviction thread should sleep before "runs" of examining
idle objects. When non-positive, no eviction thread will be launched.
-
GenericObjectPool.setMinEvictableIdleTimeMillis minEvictableIdleTimeMillis specifies the minimum amount of time that an object may sit idle in the pool
before it is eligable for eviction due to idle time. When non-positive, no object
will be dropped from the pool due to idle time alone.
-
GenericObjectPool.setTestWhileIdle testWhileIdle indicates whether or not idle
objects should be validated using the factory's
PoolableObjectFactory.validateObject method. Objects
that fail to validate will be dropped from the pool.
GenericObjectPool is not usable without a
PoolableObjectFactory . A
non-null factory must be provided either as a constructor argument
or via a call to
GenericObjectPool.setFactory before the pool is used.
See Also: GenericKeyedObjectPool author: Rodney Waldhoff author: Dirk Verbeeck version: $Revision: 4672 $ $Date: 2006-09-27 00:03:16 +0000 (Wed, 27 Sep 2006) $ |
Inner Class :public static class Config | |
Field Summary | |
final public static int | DEFAULT_MAX_ACTIVE The default cap on the total number of active instances from the pool. | final public static int | DEFAULT_MAX_IDLE The default cap on the number of "sleeping" instances in the pool. | final public static long | DEFAULT_MAX_WAIT The default maximum amount of time (in millis) the
GenericObjectPool.borrowObject method should block before throwing
an exception when the pool is exhausted and the
GenericObjectPool.getWhenExhaustedAction "when exhausted" action is
GenericObjectPool.WHEN_EXHAUSTED_BLOCK . | final public static long | DEFAULT_MIN_EVICTABLE_IDLE_TIME_MILLIS The default value for
GenericObjectPool.getMinEvictableIdleTimeMillis . | final public static int | DEFAULT_MIN_IDLE The default minimum number of "sleeping" instances in the pool
before before the evictor thread (if active) spawns new objects. | final public static int | DEFAULT_NUM_TESTS_PER_EVICTION_RUN The default number of objects to examine per run in the
idle object evictor. | final public static long | DEFAULT_SOFT_MIN_EVICTABLE_IDLE_TIME_MILLIS The default value for
GenericObjectPool.getSoftMinEvictableIdleTimeMillis . | final public static boolean | DEFAULT_TEST_ON_BORROW The default "test on borrow" value. | final public static boolean | DEFAULT_TEST_ON_RETURN The default "test on return" value. | final public static boolean | DEFAULT_TEST_WHILE_IDLE The default "test while idle" value. | final public static long | DEFAULT_TIME_BETWEEN_EVICTION_RUNS_MILLIS The default "time between eviction runs" value. | final public static byte | DEFAULT_WHEN_EXHAUSTED_ACTION The default "when exhausted action" for the pool. | final static Timer | EVICTION_TIMER Idle object evition Timer. | final public static byte | WHEN_EXHAUSTED_BLOCK A "when exhausted action" type indicating that when the pool
is exhausted (i.e., the maximum number
of active objects has been reached), the
GenericObjectPool.borrowObject method should block until a new object is available, or the
GenericObjectPool.getMaxWait maximum wait time has been reached. | final public static byte | WHEN_EXHAUSTED_FAIL A "when exhausted action" type indicating that when the pool is
exhausted (i.e., the maximum number of active objects has
been reached), the
GenericObjectPool.borrowObject method should fail, throwing a
NoSuchElementException . | final public static byte | WHEN_EXHAUSTED_GROW A "when exhausted action" type indicating that when the pool is
exhausted (i.e., the maximum number
of active objects has been reached), the
GenericObjectPool.borrowObject method should simply create a new object anyway. | protected PoolableObjectFactory | _factory My
PoolableObjectFactory . | protected int | _maxActive The cap on the total number of active instances from the pool. | protected long | _maxWait The maximum amount of time (in millis) the
GenericObjectPool.borrowObject method should block before throwing
an exception when the pool is exhausted and the
GenericObjectPool.getWhenExhaustedAction "when exhausted" action is
GenericObjectPool.WHEN_EXHAUSTED_BLOCK . | protected int | _numActive The number of objects
GenericObjectPool.borrowObject borrowed
from the pool, but not yet returned. | protected LinkedList | _pool My pool. | protected boolean | _testOnBorrow When true, objects will be
PoolableObjectFactory.validateObject validated before being returned by the
GenericObjectPool.borrowObject method. | protected byte | _whenExhaustedAction The action to take when the
GenericObjectPool.borrowObject method
is invoked when the pool is exhausted (the maximum number
of "active" objects has been reached). |
Constructor Summary | |
public | GenericObjectPool() Create a new GenericObjectPool. | public | GenericObjectPool(PoolableObjectFactory factory) Create a new GenericObjectPool using the specified values. | public | GenericObjectPool(PoolableObjectFactory factory, GenericObjectPool.Config config) Create a new GenericObjectPool using the specified values. | public | GenericObjectPool(PoolableObjectFactory factory, int maxActive) Create a new GenericObjectPool using the specified values. | public | GenericObjectPool(PoolableObjectFactory factory, int maxActive, byte whenExhaustedAction, long maxWait) Create a new GenericObjectPool using the specified values. | public | GenericObjectPool(PoolableObjectFactory factory, int maxActive, byte whenExhaustedAction, long maxWait, boolean testOnBorrow, boolean testOnReturn) Create a new GenericObjectPool using the specified values. | public | GenericObjectPool(PoolableObjectFactory factory, int maxActive, byte whenExhaustedAction, long maxWait, int maxIdle) Create a new GenericObjectPool using the specified values. | public | GenericObjectPool(PoolableObjectFactory factory, int maxActive, byte whenExhaustedAction, long maxWait, int maxIdle, boolean testOnBorrow, boolean testOnReturn) Create a new GenericObjectPool using the specified values. | public | GenericObjectPool(PoolableObjectFactory factory, int maxActive, byte whenExhaustedAction, long maxWait, int maxIdle, boolean testOnBorrow, boolean testOnReturn, long timeBetweenEvictionRunsMillis, int numTestsPerEvictionRun, long minEvictableIdleTimeMillis, boolean testWhileIdle) Create a new GenericObjectPool using the specified values. | public | GenericObjectPool(PoolableObjectFactory factory, int maxActive, byte whenExhaustedAction, long maxWait, int maxIdle, int minIdle, boolean testOnBorrow, boolean testOnReturn, long timeBetweenEvictionRunsMillis, int numTestsPerEvictionRun, long minEvictableIdleTimeMillis, boolean testWhileIdle) Create a new GenericObjectPool using the specified values. | public | GenericObjectPool(PoolableObjectFactory factory, int maxActive, byte whenExhaustedAction, long maxWait, int maxIdle, int minIdle, boolean testOnBorrow, boolean testOnReturn, long timeBetweenEvictionRunsMillis, int numTestsPerEvictionRun, long minEvictableIdleTimeMillis, boolean testWhileIdle, long softMinEvictableIdleTimeMillis) Create a new GenericObjectPool using the specified values.
Parameters: factory - the (possibly null)PoolableObjectFactory to use to create, validate and destroy objects Parameters: maxActive - the maximum number of objects that can be borrowed from me at one time (see GenericObjectPool.setMaxActive) Parameters: whenExhaustedAction - the action to take when the pool is exhausted (see GenericObjectPool.setWhenExhaustedAction) Parameters: maxWait - the maximum amount of time to wait for an idle object when the pool is exhausted an and whenExhaustedAction is GenericObjectPool.WHEN_EXHAUSTED_BLOCK (otherwise ignored) (see GenericObjectPool.setMaxWait) Parameters: maxIdle - the maximum number of idle objects in my pool (see GenericObjectPool.setMaxIdle) Parameters: minIdle - the minimum number of idle objects in my pool (see GenericObjectPool.setMinIdle) Parameters: testOnBorrow - whether or not to validate objects before they are returned by the GenericObjectPool.borrowObject method (see GenericObjectPool.setTestOnBorrow) Parameters: testOnReturn - whether or not to validate objects after they are returned to the GenericObjectPool.returnObject method (see GenericObjectPool.setTestOnReturn) Parameters: timeBetweenEvictionRunsMillis - the amount of time (in milliseconds) to sleep between examining idle objects for eviction (see GenericObjectPool.setTimeBetweenEvictionRunsMillis) Parameters: numTestsPerEvictionRun - the number of idle objects to examine per run within the idle object eviction thread (if any) (see GenericObjectPool.setNumTestsPerEvictionRun) Parameters: minEvictableIdleTimeMillis - the minimum number of milliseconds an object can sit idle in the pool before it is eligable for evcition (see GenericObjectPool.setMinEvictableIdleTimeMillis) Parameters: testWhileIdle - whether or not to validate objects in the idle object eviction thread, if any (see GenericObjectPool.setTestWhileIdle) Parameters: softMinEvictableIdleTimeMillis - the minimum number of milliseconds an object can sit idle in the pool before it is eligable for evcition with the extra condition that at least "minIdle" amount of object remain in the pool. |
Method Summary | |
public synchronized void | addObject() Create an object, and place it into the pool. | public synchronized Object | borrowObject() | public synchronized void | clear() | public synchronized void | close() | synchronized String | debugInfo() | public synchronized void | evict() | public synchronized int | getMaxActive() Returns the cap on the total number of active instances from my pool. | public synchronized int | getMaxIdle() Returns the cap on the number of "idle" instances in the pool. | public synchronized long | getMaxWait() Returns the maximum amount of time (in milliseconds) the
GenericObjectPool.borrowObject method should block before throwing
an exception when the pool is exhausted and the
GenericObjectPool.setWhenExhaustedAction "when exhausted" action is
GenericObjectPool.WHEN_EXHAUSTED_BLOCK . | public synchronized long | getMinEvictableIdleTimeMillis() Returns the minimum amount of time an object may sit idle in the pool
before it is eligable for eviction by the idle object evictor
(if any). | public synchronized int | getMinIdle() Returns the minimum number of objects allowed in the pool
before the evictor thread (if active) spawns new objects. | public synchronized int | getNumActive() | public synchronized int | getNumIdle() | public synchronized int | getNumTestsPerEvictionRun() Returns the max number of objects to examine during each run of the
idle object evictor thread (if any). | public synchronized long | getSoftMinEvictableIdleTimeMillis() Returns the minimum amount of time an object may sit idle in the pool
before it is eligable for eviction by the idle object evictor
(if any), with the extra condition that at least
"minIdle" amount of object remain in the pool. | public synchronized boolean | getTestOnBorrow() When true, objects will be
PoolableObjectFactory.validateObject validated before being returned by the
GenericObjectPool.borrowObject method. | public synchronized boolean | getTestOnReturn() When true, objects will be
PoolableObjectFactory.validateObject validated before being returned to the pool within the
GenericObjectPool.returnObject . | public synchronized boolean | getTestWhileIdle() When true, objects will be
PoolableObjectFactory.validateObject validated by the idle object evictor (if any). | public synchronized long | getTimeBetweenEvictionRunsMillis() Returns the number of milliseconds to sleep between runs of the
idle object evictor thread. | public synchronized byte | getWhenExhaustedAction() Returns the action to take when the
GenericObjectPool.borrowObject method
is invoked when the pool is exhausted (the maximum number
of "active" objects has been reached). | public synchronized void | invalidateObject(Object obj) | public synchronized void | returnObject(Object obj) | public synchronized void | setConfig(GenericObjectPool.Config conf) Sets my configuration. | public synchronized void | setFactory(PoolableObjectFactory factory) | public synchronized void | setMaxActive(int maxActive) Sets the cap on the total number of active instances from my pool. | public synchronized void | setMaxIdle(int maxIdle) Sets the cap on the number of "idle" instances in the pool. | public synchronized void | setMaxWait(long maxWait) Sets the maximum amount of time (in milliseconds) the
GenericObjectPool.borrowObject method should block before throwing
an exception when the pool is exhausted and the
GenericObjectPool.setWhenExhaustedAction "when exhausted" action is
GenericObjectPool.WHEN_EXHAUSTED_BLOCK . | public synchronized void | setMinEvictableIdleTimeMillis(long minEvictableIdleTimeMillis) Sets the minimum amount of time an object may sit idle in the pool
before it is eligable for eviction by the idle object evictor
(if any). | public synchronized void | setMinIdle(int minIdle) Sets the minimum number of objects allowed in the pool
before the evictor thread (if active) spawns new objects. | public synchronized void | setNumTestsPerEvictionRun(int numTestsPerEvictionRun) Sets the max number of objects to examine during each run of the
idle object evictor thread (if any).
When a negative value is supplied, ceil(
GenericObjectPool.getNumIdle )/abs(
GenericObjectPool.getNumTestsPerEvictionRun )
tests will be run. | public synchronized void | setSoftMinEvictableIdleTimeMillis(long softMinEvictableIdleTimeMillis) Sets the minimum amount of time an object may sit idle in the pool
before it is eligable for eviction by the idle object evictor
(if any), with the extra condition that at least
"minIdle" amount of object remain in the pool. | public synchronized void | setTestOnBorrow(boolean testOnBorrow) When true, objects will be
PoolableObjectFactory.validateObject validated before being returned by the
GenericObjectPool.borrowObject method. | public synchronized void | setTestOnReturn(boolean testOnReturn) When true, objects will be
PoolableObjectFactory.validateObject validated before being returned to the pool within the
GenericObjectPool.returnObject . | public synchronized void | setTestWhileIdle(boolean testWhileIdle) When true, objects will be
PoolableObjectFactory.validateObject validated by the idle object evictor (if any). | public synchronized void | setTimeBetweenEvictionRunsMillis(long timeBetweenEvictionRunsMillis) Sets the number of milliseconds to sleep between runs of the
idle object evictor thread. | public synchronized void | setWhenExhaustedAction(byte whenExhaustedAction) Sets the action to take when the
GenericObjectPool.borrowObject method
is invoked when the pool is exhausted (the maximum number
of "active" objects has been reached). | protected synchronized void | startEvictor(long delay) Start the eviction thread or service, or when
delay is non-positive, stop it
if it is already running. |
EVICTION_TIMER | final static Timer EVICTION_TIMER(Code) | | Idle object evition Timer. Shared between all
GenericObjectPool s and
GenericKeyedObjectPool s.
|
_factory | protected PoolableObjectFactory _factory(Code) | | My
PoolableObjectFactory .
|
GenericObjectPool | public GenericObjectPool()(Code) | | Create a new GenericObjectPool.
|
GenericObjectPool | public GenericObjectPool(PoolableObjectFactory factory)(Code) | | Create a new GenericObjectPool using the specified values.
Parameters: factory - the (possibly null)PoolableObjectFactory to use to create, validate and destroy objects |
GenericObjectPool | public GenericObjectPool(PoolableObjectFactory factory, GenericObjectPool.Config config)(Code) | | Create a new GenericObjectPool using the specified values.
Parameters: factory - the (possibly null)PoolableObjectFactory to use to create, validate and destroy objects Parameters: config - a non-null GenericObjectPool.Config describing my configuration |
GenericObjectPool | public GenericObjectPool(PoolableObjectFactory factory, int maxActive)(Code) | | Create a new GenericObjectPool using the specified values.
Parameters: factory - the (possibly null)PoolableObjectFactory to use to create, validate and destroy objects Parameters: maxActive - the maximum number of objects that can be borrowed from me at one time (see GenericObjectPool.setMaxActive) |
GenericObjectPool | public GenericObjectPool(PoolableObjectFactory factory, int maxActive, byte whenExhaustedAction, long maxWait)(Code) | | Create a new GenericObjectPool using the specified values.
Parameters: factory - the (possibly null)PoolableObjectFactory to use to create, validate and destroy objects Parameters: maxActive - the maximum number of objects that can be borrowed from me at one time (see GenericObjectPool.setMaxActive) Parameters: whenExhaustedAction - the action to take when the pool is exhausted (see GenericObjectPool.getWhenExhaustedAction) Parameters: maxWait - the maximum amount of time to wait for an idle object when the pool is exhausted an and whenExhaustedAction is GenericObjectPool.WHEN_EXHAUSTED_BLOCK (otherwise ignored) (see GenericObjectPool.getMaxWait) |
GenericObjectPool | public GenericObjectPool(PoolableObjectFactory factory, int maxActive, byte whenExhaustedAction, long maxWait, int maxIdle)(Code) | | Create a new GenericObjectPool using the specified values.
Parameters: factory - the (possibly null)PoolableObjectFactory to use to create, validate and destroy objects Parameters: maxActive - the maximum number of objects that can be borrowed from me at one time (see GenericObjectPool.setMaxActive) Parameters: whenExhaustedAction - the action to take when the pool is exhausted (see GenericObjectPool.getWhenExhaustedAction) Parameters: maxWait - the maximum amount of time to wait for an idle object when the pool is exhausted an and whenExhaustedAction is GenericObjectPool.WHEN_EXHAUSTED_BLOCK (otherwise ignored) (see GenericObjectPool.getMaxWait) Parameters: maxIdle - the maximum number of idle objects in my pool (see GenericObjectPool.getMaxIdle) |
GenericObjectPool | public GenericObjectPool(PoolableObjectFactory factory, int maxActive, byte whenExhaustedAction, long maxWait, int maxIdle, boolean testOnBorrow, boolean testOnReturn, long timeBetweenEvictionRunsMillis, int numTestsPerEvictionRun, long minEvictableIdleTimeMillis, boolean testWhileIdle)(Code) | | Create a new GenericObjectPool using the specified values.
Parameters: factory - the (possibly null)PoolableObjectFactory to use to create, validate and destroy objects Parameters: maxActive - the maximum number of objects that can be borrowed from me at one time (see GenericObjectPool.setMaxActive) Parameters: whenExhaustedAction - the action to take when the pool is exhausted (see GenericObjectPool.setWhenExhaustedAction) Parameters: maxWait - the maximum amount of time to wait for an idle object when the pool is exhausted an and whenExhaustedAction is GenericObjectPool.WHEN_EXHAUSTED_BLOCK (otherwise ignored) (see GenericObjectPool.setMaxWait) Parameters: maxIdle - the maximum number of idle objects in my pool (see GenericObjectPool.setMaxIdle) Parameters: testOnBorrow - whether or not to validate objects before they are returned by the GenericObjectPool.borrowObject method (see GenericObjectPool.setTestOnBorrow) Parameters: testOnReturn - whether or not to validate objects after they are returned to the GenericObjectPool.returnObject method (see GenericObjectPool.setTestOnReturn) Parameters: timeBetweenEvictionRunsMillis - the amount of time (in milliseconds) to sleep between examining idle objects for eviction (see GenericObjectPool.setTimeBetweenEvictionRunsMillis) Parameters: numTestsPerEvictionRun - the number of idle objects to examine per run within the idle object eviction thread (if any) (see GenericObjectPool.setNumTestsPerEvictionRun) Parameters: minEvictableIdleTimeMillis - the minimum number of milliseconds an object can sit idle in the pool before it is eligable for evcition (see GenericObjectPool.setMinEvictableIdleTimeMillis) Parameters: testWhileIdle - whether or not to validate objects in the idle object eviction thread, if any (see GenericObjectPool.setTestWhileIdle) |
GenericObjectPool | public GenericObjectPool(PoolableObjectFactory factory, int maxActive, byte whenExhaustedAction, long maxWait, int maxIdle, int minIdle, boolean testOnBorrow, boolean testOnReturn, long timeBetweenEvictionRunsMillis, int numTestsPerEvictionRun, long minEvictableIdleTimeMillis, boolean testWhileIdle)(Code) | | Create a new GenericObjectPool using the specified values.
Parameters: factory - the (possibly null)PoolableObjectFactory to use to create, validate and destroy objects Parameters: maxActive - the maximum number of objects that can be borrowed from me at one time (see GenericObjectPool.setMaxActive) Parameters: whenExhaustedAction - the action to take when the pool is exhausted (see GenericObjectPool.setWhenExhaustedAction) Parameters: maxWait - the maximum amount of time to wait for an idle object when the pool is exhausted an and whenExhaustedAction is GenericObjectPool.WHEN_EXHAUSTED_BLOCK (otherwise ignored) (see GenericObjectPool.setMaxWait) Parameters: maxIdle - the maximum number of idle objects in my pool (see GenericObjectPool.setMaxIdle) Parameters: minIdle - the minimum number of idle objects in my pool (see GenericObjectPool.setMinIdle) Parameters: testOnBorrow - whether or not to validate objects before they are returned by the GenericObjectPool.borrowObject method (see GenericObjectPool.setTestOnBorrow) Parameters: testOnReturn - whether or not to validate objects after they are returned to the GenericObjectPool.returnObject method (see GenericObjectPool.setTestOnReturn) Parameters: timeBetweenEvictionRunsMillis - the amount of time (in milliseconds) to sleep between examining idle objects for eviction (see GenericObjectPool.setTimeBetweenEvictionRunsMillis) Parameters: numTestsPerEvictionRun - the number of idle objects to examine per run within the idle object eviction thread (if any) (see GenericObjectPool.setNumTestsPerEvictionRun) Parameters: minEvictableIdleTimeMillis - the minimum number of milliseconds an object can sit idle in the pool before it is eligable for evcition (see GenericObjectPool.setMinEvictableIdleTimeMillis) Parameters: testWhileIdle - whether or not to validate objects in the idle object eviction thread, if any (see GenericObjectPool.setTestWhileIdle) |
GenericObjectPool | public GenericObjectPool(PoolableObjectFactory factory, int maxActive, byte whenExhaustedAction, long maxWait, int maxIdle, int minIdle, boolean testOnBorrow, boolean testOnReturn, long timeBetweenEvictionRunsMillis, int numTestsPerEvictionRun, long minEvictableIdleTimeMillis, boolean testWhileIdle, long softMinEvictableIdleTimeMillis)(Code) | | Create a new GenericObjectPool using the specified values.
Parameters: factory - the (possibly null)PoolableObjectFactory to use to create, validate and destroy objects Parameters: maxActive - the maximum number of objects that can be borrowed from me at one time (see GenericObjectPool.setMaxActive) Parameters: whenExhaustedAction - the action to take when the pool is exhausted (see GenericObjectPool.setWhenExhaustedAction) Parameters: maxWait - the maximum amount of time to wait for an idle object when the pool is exhausted an and whenExhaustedAction is GenericObjectPool.WHEN_EXHAUSTED_BLOCK (otherwise ignored) (see GenericObjectPool.setMaxWait) Parameters: maxIdle - the maximum number of idle objects in my pool (see GenericObjectPool.setMaxIdle) Parameters: minIdle - the minimum number of idle objects in my pool (see GenericObjectPool.setMinIdle) Parameters: testOnBorrow - whether or not to validate objects before they are returned by the GenericObjectPool.borrowObject method (see GenericObjectPool.setTestOnBorrow) Parameters: testOnReturn - whether or not to validate objects after they are returned to the GenericObjectPool.returnObject method (see GenericObjectPool.setTestOnReturn) Parameters: timeBetweenEvictionRunsMillis - the amount of time (in milliseconds) to sleep between examining idle objects for eviction (see GenericObjectPool.setTimeBetweenEvictionRunsMillis) Parameters: numTestsPerEvictionRun - the number of idle objects to examine per run within the idle object eviction thread (if any) (see GenericObjectPool.setNumTestsPerEvictionRun) Parameters: minEvictableIdleTimeMillis - the minimum number of milliseconds an object can sit idle in the pool before it is eligable for evcition (see GenericObjectPool.setMinEvictableIdleTimeMillis) Parameters: testWhileIdle - whether or not to validate objects in the idle object eviction thread, if any (see GenericObjectPool.setTestWhileIdle) Parameters: softMinEvictableIdleTimeMillis - the minimum number of milliseconds an object can sit idle in the pool before it is eligable for evcition with the extra condition that at least "minIdle" amount of object remain in the pool. (see GenericObjectPool.setSoftMinEvictableIdleTimeMillis) |
addObject | public synchronized void addObject() throws Exception(Code) | | Create an object, and place it into the pool.
addObject() is useful for "pre-loading" a pool with idle objects.
|
clear | public synchronized void clear()(Code) | | |
getMaxActive | public synchronized int getMaxActive()(Code) | | Returns the cap on the total number of active instances from my pool.
the cap on the total number of active instances from my pool. See Also: GenericObjectPool.setMaxActive |
getMaxIdle | public synchronized int getMaxIdle()(Code) | | Returns the cap on the number of "idle" instances in the pool.
the cap on the number of "idle" instances in the pool. See Also: GenericObjectPool.setMaxIdle |
getMinIdle | public synchronized int getMinIdle()(Code) | | Returns the minimum number of objects allowed in the pool
before the evictor thread (if active) spawns new objects.
(Note no objects are created when: numActive + numIdle >= maxActive)
The minimum number of objects. See Also: GenericObjectPool.setMinIdle |
getNumActive | public synchronized int getNumActive()(Code) | | |
getNumIdle | public synchronized int getNumIdle()(Code) | | |
getSoftMinEvictableIdleTimeMillis | public synchronized long getSoftMinEvictableIdleTimeMillis()(Code) | | Returns the minimum amount of time an object may sit idle in the pool
before it is eligable for eviction by the idle object evictor
(if any), with the extra condition that at least
"minIdle" amount of object remain in the pool.
See Also: GenericObjectPool.setSoftMinEvictableIdleTimeMillis |
getTestOnBorrow | public synchronized boolean getTestOnBorrow()(Code) | | When true, objects will be
PoolableObjectFactory.validateObject validated before being returned by the
GenericObjectPool.borrowObject method. If the object fails to validate,
it will be dropped from the pool, and we will attempt
to borrow another.
See Also: GenericObjectPool.setTestOnBorrow |
getTimeBetweenEvictionRunsMillis | public synchronized long getTimeBetweenEvictionRunsMillis()(Code) | | Returns the number of milliseconds to sleep between runs of the
idle object evictor thread.
When non-positive, no idle object evictor thread will be
run.
See Also: GenericObjectPool.setTimeBetweenEvictionRunsMillis |
setMaxActive | public synchronized void setMaxActive(int maxActive)(Code) | | Sets the cap on the total number of active instances from my pool.
Parameters: maxActive - The cap on the total number of active instances from my pool.Use a negative value for an infinite number of instances. See Also: GenericObjectPool.getMaxActive |
setMaxIdle | public synchronized void setMaxIdle(int maxIdle)(Code) | | Sets the cap on the number of "idle" instances in the pool.
Parameters: maxIdle - The cap on the number of "idle" instances in the pool.Use a negative value to indicate an unlimited numberof idle instances. See Also: GenericObjectPool.getMaxIdle |
setMinIdle | public synchronized void setMinIdle(int minIdle)(Code) | | Sets the minimum number of objects allowed in the pool
before the evictor thread (if active) spawns new objects.
(Note no objects are created when: numActive + numIdle >= maxActive)
Parameters: minIdle - The minimum number of objects. See Also: GenericObjectPool.getMinIdle |
setSoftMinEvictableIdleTimeMillis | public synchronized void setSoftMinEvictableIdleTimeMillis(long softMinEvictableIdleTimeMillis)(Code) | | Sets the minimum amount of time an object may sit idle in the pool
before it is eligable for eviction by the idle object evictor
(if any), with the extra condition that at least
"minIdle" amount of object remain in the pool.
When non-positive, no objects will be evicted from the pool
due to idle time alone.
See Also: GenericObjectPool.getSoftMinEvictableIdleTimeMillis |
setTestOnBorrow | public synchronized void setTestOnBorrow(boolean testOnBorrow)(Code) | | When true, objects will be
PoolableObjectFactory.validateObject validated before being returned by the
GenericObjectPool.borrowObject method. If the object fails to validate,
it will be dropped from the pool, and we will attempt
to borrow another.
See Also: GenericObjectPool.getTestOnBorrow |
setTimeBetweenEvictionRunsMillis | public synchronized void setTimeBetweenEvictionRunsMillis(long timeBetweenEvictionRunsMillis)(Code) | | Sets the number of milliseconds to sleep between runs of the
idle object evictor thread.
When non-positive, no idle object evictor thread will be
run.
See Also: GenericObjectPool.getTimeBetweenEvictionRunsMillis |
startEvictor | protected synchronized void startEvictor(long delay)(Code) | | Start the eviction thread or service, or when
delay is non-positive, stop it
if it is already running.
|
|
|