Example usage for Java org.apache.commons.pool.impl GenericObjectPool fields, constructors, methods, implement or subclass
The text is from its open source code.
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 #borrowObject method should fail, throwing a NoSuchElementException . |
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 #borrowObject method should block until a new object is available, or the #getMaxWait maximum wait time has been reached. |
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 #borrowObject method should simply create a new object anyway. |
int | DEFAULT_MAX_IDLE The default cap on the number of "sleeping" instances in the pool. |
int | DEFAULT_MIN_IDLE The default minimum number of "sleeping" instances in the pool before before the evictor thread (if active) spawns new objects. |
int | DEFAULT_MAX_ACTIVE The default cap on the total number of active instances from the pool. |
byte | DEFAULT_WHEN_EXHAUSTED_ACTION The default "when exhausted action" for the pool. |
boolean | DEFAULT_LIFO The default LIFO status. |
long | DEFAULT_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 . |
boolean | DEFAULT_TEST_ON_BORROW The default "test on borrow" value. |
boolean | DEFAULT_TEST_ON_RETURN The default "test on return" value. |
boolean | DEFAULT_TEST_WHILE_IDLE The default "test while idle" value. |
long | DEFAULT_TIME_BETWEEN_EVICTION_RUNS_MILLIS The default "time between eviction runs" value. |
int | DEFAULT_NUM_TESTS_PER_EVICTION_RUN The default number of objects to examine per run in the idle object evictor. |
long | DEFAULT_MIN_EVICTABLE_IDLE_TIME_MILLIS The default value for #getMinEvictableIdleTimeMillis . |
long | DEFAULT_SOFT_MIN_EVICTABLE_IDLE_TIME_MILLIS The default value for #getSoftMinEvictableIdleTimeMillis . |
void | addObject() Create an object, and place it into the pool. |
Object | borrowObject() 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. |
void | clear() Clears any objects sitting idle in the pool. |
void | close() Closes the pool. |
void | evict() Perform |
boolean | getLifo() Whether or not the idle object pool acts as a LIFO queue. |
int | getMaxActive() 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. |
int | getMaxIdle() Returns the cap on the number of "idle" instances in the pool. |
long | getMaxWait() 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 . |
long | getMinEvictableIdleTimeMillis() 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). |
int | getMinIdle() Returns the minimum number of objects allowed in the pool before the evictor thread (if active) spawns new objects. |
int | getNumActive() Return the number of instances currently borrowed from this pool. |
int | getNumIdle() Return the number of instances currently idle in this pool. |
int | getNumTestsPerEvictionRun() Returns the max number of objects to examine during each run of the idle object evictor thread (if any). |
long | getSoftMinEvictableIdleTimeMillis() 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. |
boolean | getTestOnBorrow() When true, objects will be PoolableObjectFactory#validateObject validated before being returned by the #borrowObject method. |
boolean | getTestOnReturn() When true, objects will be PoolableObjectFactory#validateObject validated before being returned to the pool within the #returnObject . |
boolean | getTestWhileIdle() When true, objects will be PoolableObjectFactory#validateObject validated by the idle object evictor (if any). |
long | getTimeBetweenEvictionRunsMillis() Returns the number of milliseconds to sleep between runs of the idle object evictor thread. |
byte | getWhenExhaustedAction() 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). |
void | invalidateObject(Object obj) Invalidates the given object instance. |
void | returnObject(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. |
void | setConfig(GenericObjectPool.Config conf) Sets my configuration. |
void | setFactory(PoolableObjectFactory factory) Sets the PoolableObjectFactory factory this pool uses to create new instances. |
void | setLifo(boolean lifo) Sets the LIFO property of the pool. |
void | setMaxActive(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. |
void | setMaxIdle(int maxIdle) Sets the cap on the number of "idle" instances in the pool. |
void | setMaxWait(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 . |
void | setMinEvictableIdleTimeMillis(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). |
void | setMinIdle(int minIdle) Sets the minimum number of objects allowed in the pool before the evictor thread (if active) spawns new objects. |
void | setNumTestsPerEvictionRun(int numTestsPerEvictionRun) Sets the max number of objects to examine during each run of the idle object evictor thread (if any). |
void | setSoftMinEvictableIdleTimeMillis(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. |
void | setTestOnBorrow(boolean testOnBorrow) When true, objects will be PoolableObjectFactory#validateObject validated before being returned by the #borrowObject method. |
void | setTestOnReturn(boolean testOnReturn) When true, objects will be PoolableObjectFactory#validateObject validated before being returned to the pool within the #returnObject . |
void | setTestWhileIdle(boolean testWhileIdle) When true, objects will be PoolableObjectFactory#validateObject validated by the idle object evictor (if any). |
void | setTimeBetweenEvictionRunsMillis(long timeBetweenEvictionRunsMillis) Sets the number of milliseconds to sleep between runs of the idle object evictor thread. |
void | setWhenExhaustedAction(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). |