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

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

Introduction

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

The text is from its open source code.

Subclass

org.apache.commons.pool.impl.GenericObjectPool 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 "sleeping" instances in the pool.
intDEFAULT_MIN_IDLE
The default minimum number of "sleeping" instances in the pool before before the evictor thread (if active) spawns new objects.
intDEFAULT_MAX_ACTIVE
The default cap on the total number of active instances from the pool.
byteDEFAULT_WHEN_EXHAUSTED_ACTION
The default "when exhausted action" for the pool.
booleanDEFAULT_LIFO
The default LIFO status.
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 .
longDEFAULT_SOFT_MIN_EVICTABLE_IDLE_TIME_MILLIS
The default value for #getSoftMinEvictableIdleTimeMillis .

Constructor

GenericObjectPool(PoolableObjectFactory factory)
Create a new GenericObjectPool using the specified factory.
GenericObjectPool()
Create a new GenericObjectPool with default properties.
GenericObjectPool(PoolableObjectFactory factory, GenericObjectPool.Config config)
Create a new GenericObjectPool using the specified values.
GenericObjectPool(PoolableObjectFactory factory, int maxActive)
Create a new GenericObjectPool using the specified values.
GenericObjectPool(PoolableObjectFactory factory, int maxActive, byte whenExhaustedAction, long maxWait)
Create a new GenericObjectPool using the specified values.
GenericObjectPool(PoolableObjectFactory factory, int maxActive, byte whenExhaustedAction, long maxWait, int maxIdle, boolean testOnBorrow, boolean testOnReturn)
Create a new GenericObjectPool using the specified values.
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.
GenericObjectPool(PoolableObjectFactory factory, int maxActive, byte whenExhaustedAction, long maxWait, boolean testOnBorrow, boolean testOnReturn)
Create a new GenericObjectPool using the specified values.
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.
GenericObjectPool(PoolableObjectFactory factory, int maxActive, byte whenExhaustedAction, long maxWait, int maxIdle)
Create a new GenericObjectPool using the specified values.
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, boolean lifo)
Create a new GenericObjectPool using the specified values.

Method

voidaddObject()
Create an object, and place it into the pool.
ObjectborrowObject()

Borrows an object from the pool.

If there is an idle instance available in the pool, 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.

voidclear()
Clears any objects sitting idle in the pool.
voidclose()
Closes the pool.
voidevict()

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

booleangetLifo()
Whether or not the idle object pool acts as a LIFO queue.
intgetMaxActive()
Returns the maximum number of objects that can be allocated by the pool (checked out to clients, or idle awaiting checkout) at a given time.
intgetMaxIdle()
Returns the cap on the number of "idle" instances in the pool.
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 objects allowed in the pool before the evictor thread (if active) spawns new objects.
intgetNumActive()
Return the number of instances currently borrowed from this pool.
intgetNumIdle()
Return the number of instances currently idle in this pool.
intgetNumTestsPerEvictionRun()
Returns the max number of objects to examine during each run of the idle object evictor thread (if any).
longgetSoftMinEvictableIdleTimeMillis()
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), with the extra condition that at least "minIdle" amount of object remain in the pool.
booleangetTestOnBorrow()
When true, objects will be PoolableObjectFactory#validateObject validated before being returned by the #borrowObject method.
booleangetTestOnReturn()
When true, objects will be PoolableObjectFactory#validateObject validated before being returned to the pool within the #returnObject .
booleangetTestWhileIdle()
When true, objects will be 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).
voidinvalidateObject(Object obj)

Invalidates the given object instance.

voidreturnObject(Object obj)

Returns an object instance to the pool.

If #getMaxIdle() maxIdle is set to a positive value and the number of idle instances has reached this value, the returning instance is destroyed.

If #getTestOnReturn() testOnReturn == true, the returning instance is validated before being returned to the idle instance pool.

voidsetConfig(GenericObjectPool.Config conf)
Sets my configuration.
voidsetFactory(PoolableObjectFactory factory)
Sets the PoolableObjectFactory factory this pool uses to create new instances.
voidsetLifo(boolean lifo)
Sets the LIFO property of the pool.
voidsetMaxActive(int maxActive)
Sets the cap on the number of objects that can be allocated by the pool (checked out to clients, or idle awaiting checkout) at a given time.
voidsetMaxIdle(int maxIdle)
Sets the cap on the number of "idle" instances in the pool.
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 minIdle)
Sets the minimum number of objects allowed in the pool before the evictor thread (if active) spawns new objects.
voidsetNumTestsPerEvictionRun(int numTestsPerEvictionRun)
Sets the max number of objects to examine during each run of the idle object evictor thread (if any).
voidsetSoftMinEvictableIdleTimeMillis(long softMinEvictableIdleTimeMillis)
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), with the extra condition that at least "minIdle" object instances remain in the pool.
voidsetTestOnBorrow(boolean testOnBorrow)
When true, objects will be PoolableObjectFactory#validateObject validated before being returned by the #borrowObject method.
voidsetTestOnReturn(boolean testOnReturn)
When true, objects will be PoolableObjectFactory#validateObject validated before being returned to the pool within the #returnObject .
voidsetTestWhileIdle(boolean testWhileIdle)
When true, objects will be 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).