Java org.apache.commons.pool.impl GenericKeyedObjectPool fields, constructors, methods, implement or subclass

Example usage for Java org.apache.commons.pool.impl GenericKeyedObjectPool fields, constructors, methods, implement or subclass

Introduction

In this page you can find the methods, fields and constructors for org.apache.commons.pool.impl GenericKeyedObjectPool.

The text is from its open source code.

Subclass

org.apache.commons.pool.impl.GenericKeyedObjectPool has subclasses.
Click this link to see all its subclasses.

Field

byteWHEN_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 #borrowObject method should fail, throwing a NoSuchElementException .
byteWHEN_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 #borrowObject method should block until a new object is available, or the #getMaxWait maximum wait time has been reached.
byteWHEN_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 #borrowObject method should simply create a new object anyway.
intDEFAULT_MAX_IDLE
The default cap on the number of idle instances (per key) in the pool.
intDEFAULT_MAX_ACTIVE
The default cap on the total number of active instances (per key) from the pool.
intDEFAULT_MAX_TOTAL
The default cap on the the overall maximum number of objects that can exist at one time.
byteDEFAULT_WHEN_EXHAUSTED_ACTION
The default "when exhausted action" for the pool.
longDEFAULT_MAX_WAIT
The default maximum amount of time (in milliseconds) the #borrowObject method should block before throwing an exception when the pool is exhausted and the #getWhenExhaustedAction "when exhausted" action is #WHEN_EXHAUSTED_BLOCK .
booleanDEFAULT_TEST_ON_BORROW
The default "test on borrow" value.
booleanDEFAULT_TEST_ON_RETURN
The default "test on return" value.
booleanDEFAULT_TEST_WHILE_IDLE
The default "test while idle" value.
longDEFAULT_TIME_BETWEEN_EVICTION_RUNS_MILLIS
The default "time between eviction runs" value.
intDEFAULT_NUM_TESTS_PER_EVICTION_RUN
The default number of objects to examine per run in the idle object evictor.
longDEFAULT_MIN_EVICTABLE_IDLE_TIME_MILLIS
The default value for #getMinEvictableIdleTimeMillis .
intDEFAULT_MIN_IDLE
The default minimum level of idle objects in the pool.
booleanDEFAULT_LIFO
The default LIFO status.

Constructor

Method

voidaddObject(Object key)
Create an object using the KeyedPoolableObjectFactory#makeObject factory , passivate it, and then place it in the idle object pool.
ObjectborrowObject(Object key)

Borrows an object from the keyed pool associated with the given key.

If there is an idle instance available in the pool associated with the given key, then either the most-recently returned (if #getLifo() lifo == true) or "oldest" (lifo == false) instance sitting idle in the pool will be activated and returned.

voidclose()
Closes the keyed object pool.
voidevict()

Perform numTests idle object eviction tests, evicting examined objects that meet the criteria for eviction.

booleangetLifo()
Whether or not the idle object pools act as LIFO queues.
intgetMaxActive()
Returns the cap on the number of object instances allocated by the pool (checked out or idle), per key.
intgetMaxIdle()
Returns the cap on the number of "idle" instances per key.
intgetMaxTotal()
Returns the overall maximum number of objects (across pools) that can exist at one time.
longgetMaxWait()
Returns the maximum amount of time (in milliseconds) the #borrowObject method should block before throwing an exception when the pool is exhausted and the #setWhenExhaustedAction "when exhausted" action is #WHEN_EXHAUSTED_BLOCK .
longgetMinEvictableIdleTimeMillis()
Returns the minimum amount of time an object may sit idle in the pool before it is eligible for eviction by the idle object evictor (if any).
intgetMinIdle()
Returns the minimum number of idle objects to maintain in each of the keyed pools.
intgetNumActive(Object key)
Returns the number of instances currently borrowed from but not yet returned to the pool corresponding to the given key.
intgetNumIdle(Object key)
Returns the number of instances corresponding to the given key currently idle in this pool.
intgetNumIdle()
Returns the total number of instances currently idle in this pool.
intgetNumTestsPerEvictionRun()
Returns the number of objects to examine during each run of the idle object evictor thread (if any).
booleangetTestOnBorrow()
When true, objects will be org.apache.commons.pool.PoolableObjectFactory#validateObject validated before being returned by the #borrowObject method.
booleangetTestOnReturn()
When true, objects will be org.apache.commons.pool.PoolableObjectFactory#validateObject validated before being returned to the pool within the #returnObject .
booleangetTestWhileIdle()
When true, objects will be org.apache.commons.pool.PoolableObjectFactory#validateObject validated by the idle object evictor (if any).
longgetTimeBetweenEvictionRunsMillis()
Returns the number of milliseconds to sleep between runs of the idle object evictor thread.
bytegetWhenExhaustedAction()
Returns the action to take when the #borrowObject method is invoked when the pool is exhausted (the maximum number of "active" objects has been reached).
voidreturnObject(Object key, Object obj)

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.

voidsetFactory(KeyedPoolableObjectFactory factory)

Sets the keyed poolable object factory associated with this pool.

If this method is called when objects are checked out of any of the keyed pools, an IllegalStateException is thrown.

voidsetLifo(boolean lifo)
Sets the LIFO property of the pools.
voidsetMaxActive(int maxActive)
Sets the cap on the number of object instances managed by the pool per key.
voidsetMaxIdle(int maxIdle)
Sets the cap on the number of "idle" instances in the pool.
voidsetMaxTotal(int maxTotal)
Sets the cap on the total number of instances from all pools combined.
voidsetMaxWait(long maxWait)
Sets the maximum amount of time (in milliseconds) the #borrowObject method should block before throwing an exception when the pool is exhausted and the #setWhenExhaustedAction "when exhausted" action is #WHEN_EXHAUSTED_BLOCK .
voidsetMinEvictableIdleTimeMillis(long minEvictableIdleTimeMillis)
Sets the minimum amount of time an object may sit idle in the pool before it is eligible for eviction by the idle object evictor (if any).
voidsetMinIdle(int poolSize)
Sets the minimum number of idle objects to maintain in each of the keyed pools.
voidsetNumTestsPerEvictionRun(int numTestsPerEvictionRun)
Sets the number of objects to examine during each run of the idle object evictor thread (if any).
voidsetTestOnBorrow(boolean testOnBorrow)
When true, objects will be org.apache.commons.pool.PoolableObjectFactory#validateObject validated before being returned by the #borrowObject method.
voidsetTestOnReturn(boolean testOnReturn)
When true, objects will be org.apache.commons.pool.PoolableObjectFactory#validateObject validated before being returned to the pool within the #returnObject .
voidsetTestWhileIdle(boolean testWhileIdle)
When true, objects will be org.apache.commons.pool.PoolableObjectFactory#validateObject validated by the idle object evictor (if any).
voidsetTimeBetweenEvictionRunsMillis(long timeBetweenEvictionRunsMillis)
Sets the number of milliseconds to sleep between runs of the idle object evictor thread.
voidsetWhenExhaustedAction(byte whenExhaustedAction)
Sets the action to take when the #borrowObject method is invoked when the pool is exhausted (the maximum number of "active" objects has been reached).