Prev Class | Next Class | Frames | No Frames |
Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
java.lang.Object
org.apache.commons.pool.BaseKeyedObjectPool
org.apache.commons.pool.impl.GenericKeyedObjectPool
KeyedObjectPool
implementation.
When coupled with the appropriate KeyedPoolableObjectFactory
,
GenericKeyedObjectPool provides robust pooling functionality for
arbitrary objects.
A GenericKeyedObjectPool provides a number of configurable parameters:
maxActive
controls the maximum number of objects (per key)
that can be borrowed from the pool at one time. When non-positive, there
is no limit to the number of objects that may be active at one time.
When maxActive
is exceeded, the pool is said to be exhausted.
maxIdle
controls the maximum number of objects that can
sit idle in the pool (per key) at any time. When negative, there
is no limit to the number of objects that may be idle at one time.
whenExhaustedAction
specifies the
behaviour of the borrowObject(Object)
method when the pool is exhausted:
whenExhaustedAction
is
WHEN_EXHAUSTED_FAIL
, borrowObject(Object)
will throw
a NoSuchElementException
whenExhaustedAction
is
WHEN_EXHAUSTED_GROW
, borrowObject(Object)
will create a new
object and return it(essentially making maxActive
meaningless.)
whenExhaustedAction
is WHEN_EXHAUSTED_BLOCK
, borrowObject(Object)
will block
(invoke Object.wait
until a new or idle object is available.
If a positive maxWait
value is supplied, the borrowObject(Object)
will block for at
most that many milliseconds, after which a NoSuchElementException
will be thrown. If maxWait
is non-positive,
the borrowObject(Object)
method will block indefinitely.
testOnBorrow
is set, the pool will
attempt to validate each object before it is returned from the
borrowObject(Object)
method. (Using the provided factory's
PoolableObjectFactory.validateObject(Object)
method.) Objects that fail
to validate will be dropped from the pool, and a different object will
be borrowed.
testOnReturn
is set, the pool will
attempt to validate each object before it is returned to the pool in the
returnObject(Object,Object)
method. (Using the provided factory's
PoolableObjectFactory.validateObject(Object)
method.) Objects that fail to validate will be dropped from the pool.
timeBetweenEvictionRunsMillis
indicates how long the eviction thread should sleep before "runs" of examining
idle objects. When non-positive, no eviction thread will be launched.
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.
testWhileIdle
indicates whether or not idle
objects should be validated using the factory's
PoolableObjectFactory.validateObject(Object)
method. Objects
that fail to validate will be dropped from the pool.
KeyedPoolableObjectFactory
. A
non-null
factory must be provided either as a constructor argument
or via a call to setFactory(KeyedPoolableObjectFactory)
before the pool is used.
GenericObjectPool
Nested Class Summary | |
static class |
|
Field Summary | |
static int |
|
static int |
|
static int |
|
static long |
|
static long |
|
static int |
|
static boolean |
|
static boolean |
|
static boolean |
|
static long |
|
static byte |
|
static byte |
|
static byte |
|
static byte |
|
Constructor Summary | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
|
Method Summary | |
void | |
Object |
|
void |
|
void |
|
void |
|
void |
|
int |
|
int |
|
int |
|
long |
|
long |
|
int |
|
int |
|
int |
|
int |
|
int |
|
boolean |
|
boolean |
|
boolean |
|
long |
|
byte |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
Methods inherited from class org.apache.commons.pool.BaseKeyedObjectPool | |
addObject , borrowObject , clear , clear , close , getNumActive , getNumActive , getNumIdle , getNumIdle , invalidateObject , returnObject , setFactory |
public static final int DEFAULT_MAX_ACTIVE
The default cap on the total number of active instances from the pool (per key).
- Field Value:
- 8
- See Also:
getMaxActive()
,setMaxActive(int)
public static final int DEFAULT_MAX_IDLE
The default cap on the number of idle instances in the pool (per key).
- Field Value:
- 8
- See Also:
getMaxIdle()
,setMaxIdle(int)
public static final int DEFAULT_MAX_TOTAL
The default cap on the the maximum number of objects that can exists at one time.
- Field Value:
- -1
- See Also:
getMaxTotal()
,setMaxTotal(int)
public static final long DEFAULT_MAX_WAIT
The default maximum amount of time (in millis) theborrowObject(Object)
method should block before throwing an exception when the pool is exhausted and the"when exhausted" action
isWHEN_EXHAUSTED_BLOCK
.
- Field Value:
- -1L
- See Also:
getMaxWait()
,setMaxWait(long)
public static final long DEFAULT_MIN_EVICTABLE_IDLE_TIME_MILLIS
The default value forgetMinEvictableIdleTimeMillis()
.
- Field Value:
- 1800000L
public static final int DEFAULT_NUM_TESTS_PER_EVICTION_RUN
The default number of objects to examine per run in the idle object evictor.
- Field Value:
- 3
public static final boolean DEFAULT_TEST_ON_BORROW
The default "test on borrow" value.
- Field Value:
- false
- See Also:
getTestOnBorrow()
,setTestOnBorrow(boolean)
public static final boolean DEFAULT_TEST_ON_RETURN
The default "test on return" value.
- Field Value:
- false
- See Also:
getTestOnReturn()
,setTestOnReturn(boolean)
public static final boolean DEFAULT_TEST_WHILE_IDLE
The default "test while idle" value.
- Field Value:
- false
public static final long DEFAULT_TIME_BETWEEN_EVICTION_RUNS_MILLIS
The default "time between eviction runs" value.
- Field Value:
- -1L
public static final byte DEFAULT_WHEN_EXHAUSTED_ACTION
The default "when exhausted action" for the pool.
- Field Value:
- 1
public static final 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), theborrowObject(Object)
method should block until a new object is available, or themaximum wait time
has been reached.
- Field Value:
- 1
public static final 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), theborrowObject(Object)
method should fail, throwing aNoSuchElementException
.
- Field Value:
- 0
public static final 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), theborrowObject(Object)
method should simply create a new object anyway.
- Field Value:
- 2
public GenericKeyedObjectPool()
Create a new GenericKeyedObjectPool..
public GenericKeyedObjectPool(KeyedPoolableObjectFactory factory)
Create a new GenericKeyedObjectPool using the specified values.
- Parameters:
factory
- the (possibly null)KeyedPoolableObjectFactory to use to create, validate and destroy objects
public GenericKeyedObjectPool(KeyedPoolableObjectFactory factory, int maxActive)
Create a new GenericKeyedObjectPool using the specified values.
- Parameters:
factory
- the (possibly null)KeyedPoolableObjectFactory to use to create, validate and destroy objectsmaxActive
- the maximum number of objects that can be borrowed from me at one time (per key) (seesetMaxActive(int)
)
public GenericKeyedObjectPool(KeyedPoolableObjectFactory factory, int maxActive, byte whenExhaustedAction, long maxWait)
Create a new GenericKeyedObjectPool using the specified values.
- Parameters:
factory
- the (possibly null)KeyedPoolableObjectFactory to use to create, validate and destroy objectsmaxActive
- the maximum number of objects that can be borrowed from me at one time (per key) (seesetMaxActive(int)
)whenExhaustedAction
- the action to take when the pool is exhausted (seesetWhenExhaustedAction(byte)
)maxWait
- the maximum amount of time to wait for an idle object when the pool is exhausted an and whenExhaustedAction isWHEN_EXHAUSTED_BLOCK
(otherwise ignored) (seesetMaxWait(long)
)
public GenericKeyedObjectPool(KeyedPoolableObjectFactory factory, int maxActive, byte whenExhaustedAction, long maxWait, boolean testOnBorrow, boolean testOnReturn)
Create a new GenericKeyedObjectPool using the specified values.
- Parameters:
factory
- the (possibly null)KeyedPoolableObjectFactory to use to create, validate and destroy objectsmaxActive
- the maximum number of objects that can be borrowed from me at one time (per key) (seesetMaxActive(int)
)whenExhaustedAction
- the action to take when the pool is exhausted (seesetWhenExhaustedAction(byte)
)maxWait
- the maximum amount of time to wait for an idle object when the pool is exhausted an and whenExhaustedAction isWHEN_EXHAUSTED_BLOCK
(otherwise ignored) (seesetMaxWait(long)
)testOnBorrow
- whether or not to validate objects before they are returned by theborrowObject(Object)
method (seesetTestOnBorrow(boolean)
)testOnReturn
- whether or not to validate objects after they are returned to thereturnObject(Object,Object)
method (seesetTestOnReturn(boolean)
)
public GenericKeyedObjectPool(KeyedPoolableObjectFactory factory, int maxActive, byte whenExhaustedAction, long maxWait, int maxIdle)
Create a new GenericKeyedObjectPool using the specified values.
- Parameters:
factory
- the (possibly null)KeyedPoolableObjectFactory to use to create, validate and destroy objectsmaxActive
- the maximum number of objects that can be borrowed from me at one time (per key) (seesetMaxActive(int)
)whenExhaustedAction
- the action to take when the pool is exhausted (seesetWhenExhaustedAction(byte)
)maxWait
- the maximum amount of time to wait for an idle object when the pool is exhausted an and whenExhaustedAction isWHEN_EXHAUSTED_BLOCK
(otherwise ignored) (seesetMaxWait(long)
)maxIdle
- the maximum number of idle objects in my pool (per key) (seesetMaxIdle(int)
)
public GenericKeyedObjectPool(KeyedPoolableObjectFactory factory, int maxActive, byte whenExhaustedAction, long maxWait, int maxIdle, boolean testOnBorrow, boolean testOnReturn)
Create a new GenericKeyedObjectPool using the specified values.
- Parameters:
factory
- the (possibly null)KeyedPoolableObjectFactory to use to create, validate and destroy objectsmaxActive
- the maximum number of objects that can be borrowed from me at one time (per key) (seesetMaxActive(int)
)whenExhaustedAction
- the action to take when the pool is exhausted (seesetWhenExhaustedAction(byte)
)maxWait
- the maximum amount of time to wait for an idle object when the pool is exhausted an and whenExhaustedAction isWHEN_EXHAUSTED_BLOCK
(otherwise ignored) (seegetMaxWait()
)maxIdle
- the maximum number of idle objects in my pool (seesetMaxIdle(int)
)testOnBorrow
- whether or not to validate objects before they are returned by theborrowObject(Object)
method (seesetTestOnBorrow(boolean)
)testOnReturn
- whether or not to validate objects after they are returned to thereturnObject(Object,Object)
method (seesetTestOnReturn(boolean)
)
public GenericKeyedObjectPool(KeyedPoolableObjectFactory factory, int maxActive, byte whenExhaustedAction, long maxWait, int maxIdle, boolean testOnBorrow, boolean testOnReturn, long timeBetweenEvictionRunsMillis, int numTestsPerEvictionRun, long minEvictableIdleTimeMillis, boolean testWhileIdle)
Create a new GenericKeyedObjectPool using the specified values.
- Parameters:
factory
- the (possibly null)PoolableObjectFactory to use to create, validate and destroy objectsmaxActive
- the maximum number of objects that can be borrowed from me at one time (per key) (seesetMaxActive(int)
)whenExhaustedAction
- the action to take when the pool is exhausted (seesetWhenExhaustedAction(byte)
)maxWait
- the maximum amount of time to wait for an idle object when the pool is exhausted an and whenExhaustedAction isWHEN_EXHAUSTED_BLOCK
(otherwise ignored) (seesetMaxWait(long)
)maxIdle
- the maximum number of idle objects in my pool (seesetMaxIdle(int)
)testOnBorrow
- whether or not to validate objects before they are returned by theborrowObject(Object)
method (seesetTestOnBorrow(boolean)
)testOnReturn
- whether or not to validate objects after they are returned to thereturnObject(Object,Object)
method (seesetTestOnReturn(boolean)
)timeBetweenEvictionRunsMillis
- the amount of time (in milliseconds) to sleep between examining idle objects for eviction (seesetTimeBetweenEvictionRunsMillis(long)
)numTestsPerEvictionRun
- the number of idle objects to examine per run within the idle object eviction thread (if any) (seesetNumTestsPerEvictionRun(int)
)minEvictableIdleTimeMillis
- the minimum number of milliseconds an object can sit idle in the pool before it is eligable for evcition (seesetMinEvictableIdleTimeMillis(long)
)testWhileIdle
- whether or not to validate objects in the idle object eviction thread, if any (seesetTestWhileIdle(boolean)
)
public GenericKeyedObjectPool(KeyedPoolableObjectFactory factory, int maxActive, byte whenExhaustedAction, long maxWait, int maxIdle, int maxTotal, boolean testOnBorrow, boolean testOnReturn, long timeBetweenEvictionRunsMillis, int numTestsPerEvictionRun, long minEvictableIdleTimeMillis, boolean testWhileIdle)
Create a new GenericKeyedObjectPool using the specified values.
- Parameters:
factory
- the (possibly null)PoolableObjectFactory to use to create, validate and destroy objectsmaxActive
- the maximum number of objects that can be borrowed from me at one time (per key) (seesetMaxActive(int)
)whenExhaustedAction
- the action to take when the pool is exhausted (seesetWhenExhaustedAction(byte)
)maxWait
- the maximum amount of time to wait for an idle object when the pool is exhausted an and whenExhaustedAction isWHEN_EXHAUSTED_BLOCK
(otherwise ignored) (seesetMaxWait(long)
)maxIdle
- the maximum number of idle objects in my pool (seesetMaxIdle(int)
)maxTotal
- the maximum number of objects that can exists at one time (seesetMaxTotal(int)
)testOnBorrow
- whether or not to validate objects before they are returned by theborrowObject(Object)
method (seesetTestOnBorrow(boolean)
)testOnReturn
- whether or not to validate objects after they are returned to thereturnObject(Object,Object)
method (seesetTestOnReturn(boolean)
)timeBetweenEvictionRunsMillis
- the amount of time (in milliseconds) to sleep between examining idle objects for eviction (seesetTimeBetweenEvictionRunsMillis(long)
)numTestsPerEvictionRun
- the number of idle objects to examine per run within the idle object eviction thread (if any) (seesetNumTestsPerEvictionRun(int)
)minEvictableIdleTimeMillis
- the minimum number of milliseconds an object can sit idle in the pool before it is eligable for evcition (seesetMinEvictableIdleTimeMillis(long)
)testWhileIdle
- whether or not to validate objects in the idle object eviction thread, if any (seesetTestWhileIdle(boolean)
)
public GenericKeyedObjectPool(KeyedPoolableObjectFactory factory, GenericKeyedObjectPool.Config config)
Create a new GenericKeyedObjectPool using the specified values.
- Parameters:
factory
- the (possibly null)KeyedPoolableObjectFactory to use to create, validate and destroy objectsconfig
- a non-nullGenericKeyedObjectPool.Config
describing my configuration
public void addObject(Object key) throws Exception
Create an object using myfactory
or other implementation dependent mechanism, and place it into the pool. addObject() is useful for "pre-loading" a pool with idle objects. (Optional operation).
- Specified by:
- addObject in interface KeyedObjectPool
- Overrides:
- addObject in interface BaseKeyedObjectPool
public Object borrowObject(Object key) throws Exception
Obtain an instance from my pool for the specified key. By contract, clients MUST return the borrowed object usingreturnObject
, or a related method as defined in an implementation or sub-interface, using a key that is equivalent to the one used to borrow the instance in the first place.
- Specified by:
- borrowObject in interface KeyedObjectPool
- Overrides:
- borrowObject in interface BaseKeyedObjectPool
- Parameters:
key
- the key used to obtain the object
- Returns:
- an instance from my pool.
public void clear()
Clears my pool, removing all pooled instances (optional operation). ThrowsUnsupportedOperationException
if the pool cannot be cleared.
- Specified by:
- clear in interface KeyedObjectPool
- Overrides:
- clear in interface BaseKeyedObjectPool
public void clear(Object key)
Clears the specified pool, removing all pooled instances corresponding to the given key (optional operation). ThrowsUnsupportedOperationException
if the pool cannot be cleared.
- Specified by:
- clear in interface KeyedObjectPool
- Overrides:
- clear in interface BaseKeyedObjectPool
- Parameters:
key
- the key to clear
public void close() throws Exception
Close this pool, and free any resources associated with it.
- Specified by:
- close in interface KeyedObjectPool
- Overrides:
- close in interface BaseKeyedObjectPool
public void evict() throws Exception
public int getMaxActive()
Returns the cap on the number of active instances from my pool (per key).
- Returns:
- the cap on the number of active instances from my pool (per key).
- See Also:
setMaxActive(int)
public int getMaxIdle()
Returns the cap on the number of "idle" instances in the pool.
- Returns:
- the cap on the number of "idle" instances in the pool.
- See Also:
setMaxIdle(int)
public int getMaxTotal()
Returns the cap on the total number of instances from my pool.
- Returns:
- the cap on the total number of instances from my pool.
- See Also:
setMaxTotal(int)
public long getMaxWait()
Returns the maximum amount of time (in milliseconds) theborrowObject(Object)
method should block before throwing an exception when the pool is exhausted and the"when exhausted" action
isWHEN_EXHAUSTED_BLOCK
. When less than 0, theborrowObject(Object)
method may block indefinitely.
public 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 int getNumActive()
Returns the total number of instances current borrowed from my pool but not yet returned (optional operation). ThrowsUnsupportedOperationException
if this information is not available.
- Specified by:
- getNumActive in interface KeyedObjectPool
- Overrides:
- getNumActive in interface BaseKeyedObjectPool
- Returns:
- the total number of instances currently borrowed from my pool
public int getNumActive(Object key)
Returns the number of instances currently borrowed from but not yet returned to my pool corresponding to the given key (optional operation). ThrowsUnsupportedOperationException
if this information is not available.
- Specified by:
- getNumActive in interface KeyedObjectPool
- Overrides:
- getNumActive in interface BaseKeyedObjectPool
- Parameters:
key
- the key
- Returns:
- the number of instances corresponding to the given key currently borrowed in my pool
public int getNumIdle()
Returns the total number of instances currently idle in my pool (optional operation). ThrowsUnsupportedOperationException
if this information is not available.
- Specified by:
- getNumIdle in interface KeyedObjectPool
- Overrides:
- getNumIdle in interface BaseKeyedObjectPool
- Returns:
- the total number of instances currently idle in my pool
public int getNumIdle(Object key)
Returns the number of instances corresponding to the given key currently idle in my pool (optional operation). ThrowsUnsupportedOperationException
if this information is not available.
- Specified by:
- getNumIdle in interface KeyedObjectPool
- Overrides:
- getNumIdle in interface BaseKeyedObjectPool
- Parameters:
key
- the key
- Returns:
- the number of instances corresponding to the given key currently idle in my pool
public int getNumTestsPerEvictionRun()
Returns the number of objects to examine during each run of the idle object evictor thread (if any).
public boolean getTestOnBorrow()
When true, objects will bevalidated
before being returned by theborrowObject(Object)
method. If the object fails to validate, it will be dropped from the pool, and we will attempt to borrow another.
- See Also:
setTestOnBorrow(boolean)
public boolean getTestOnReturn()
When true, objects will bevalidated
before being returned to the pool within thereturnObject(Object,Object)
.
- See Also:
setTestOnReturn(boolean)
public boolean getTestWhileIdle()
When true, objects will bevalidated
by the idle object evictor (if any). If an object fails to validate, it will be dropped from the pool.
public long getTimeBetweenEvictionRunsMillis()
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.
public byte getWhenExhaustedAction()
Returns the action to take when theborrowObject(Object)
method is invoked when the pool is exhausted (the maximum number of "active" objects has been reached).
- Returns:
- one of
WHEN_EXHAUSTED_BLOCK
,WHEN_EXHAUSTED_FAIL
orWHEN_EXHAUSTED_GROW
- See Also:
setWhenExhaustedAction(byte)
public void invalidateObject(Object key, Object obj) throws Exception
Invalidates an object from the pool By contract, obj MUST have been obtained usingborrowObject
or a related method as defined in an implementation or sub-interface using a key that is equivalent to the one used to borrow the Object in the first place. This method should be used when an object that has been borrowed is determined (due to an exception or other problem) to be invalid. If the connection should be validated before or after borrowing, then thePoolableObjectFactory.validateObject(Object)
method should be used instead.
- Specified by:
- invalidateObject in interface KeyedObjectPool
- Overrides:
- invalidateObject in interface BaseKeyedObjectPool
- Parameters:
obj
- aborrowed
instance to be returned.
public void returnObject(Object key, Object obj) throws Exception
Return an instance to my pool. By contract, obj MUST have been obtained usingborrowObject
or a related method as defined in an implementation or sub-interface using a key that is equivalent to the one used to borrow the Object in the first place.
- Specified by:
- returnObject in interface KeyedObjectPool
- Overrides:
- returnObject in interface BaseKeyedObjectPool
- Parameters:
key
- the key used to obtain the objectobj
- aborrowed
instance to be returned.
public void setConfig(GenericKeyedObjectPool.Config conf)
Sets my configuration.
- See Also:
GenericKeyedObjectPool.Config
public void setFactory(KeyedPoolableObjectFactory factory) throws IllegalStateException
Sets thefactory
I use to create new instances (optional operation).
- Specified by:
- setFactory in interface KeyedObjectPool
- Overrides:
- setFactory in interface BaseKeyedObjectPool
- Parameters:
factory
- theKeyedPoolableObjectFactory
I use to create new instances.
public void setMaxActive(int maxActive)
Sets the cap on the number of active instances from my pool (per key).
- Parameters:
maxActive
- The cap on the number of active instances from my pool (per key). Use a negative value for an infinite number of instances.
- See Also:
getMaxActive()
public void setMaxIdle(int maxIdle)
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 number of idle instances.
- See Also:
getMaxIdle()
public void setMaxTotal(int maxTotal)
Sets the cap on the total number of instances from my pool.
- Parameters:
maxTotal
- The cap on the total number of instances from my pool. Use a negative value for an infinite number of instances.
- See Also:
getMaxTotal()
public void setMaxWait(long maxWait)
Sets the maximum amount of time (in milliseconds) theborrowObject(Object)
method should block before throwing an exception when the pool is exhausted and the"when exhausted" action
isWHEN_EXHAUSTED_BLOCK
. When less than 0, theborrowObject(Object)
method may block indefinitely.
public 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). When non-positive, no objects will be evicted from the pool due to idle time alone.
public void setNumTestsPerEvictionRun(int numTestsPerEvictionRun)
Sets the number of objects to examine during each run of the idle object evictor thread (if any). When a negative value is supplied, ceil(getNumIdle
)/abs(getNumTestsPerEvictionRun()
) tests will be run. I.e., when the value is -n, roughly one nth of the idle objects will be tested per run.
public void setTestOnBorrow(boolean testOnBorrow)
When true, objects will bevalidated
before being returned by theborrowObject(Object)
method. If the object fails to validate, it will be dropped from the pool, and we will attempt to borrow another.
- See Also:
getTestOnBorrow()
public void setTestOnReturn(boolean testOnReturn)
When true, objects will bevalidated
before being returned to the pool within thereturnObject(Object,Object)
.
- See Also:
getTestOnReturn()
public void setTestWhileIdle(boolean testWhileIdle)
When true, objects will bevalidated
by the idle object evictor (if any). If an object fails to validate, it will be dropped from the pool.
public void setTimeBetweenEvictionRunsMillis(long timeBetweenEvictionRunsMillis)
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:
getTimeBetweenEvictionRunsMillis()
public void setWhenExhaustedAction(byte whenExhaustedAction)
Sets the action to take when theborrowObject(Object)
method is invoked when the pool is exhausted (the maximum number of "active" objects has been reached).
- Parameters:
whenExhaustedAction
- the action code, which must be one ofWHEN_EXHAUSTED_BLOCK
,WHEN_EXHAUSTED_FAIL
, orWHEN_EXHAUSTED_GROW
- See Also:
getWhenExhaustedAction()