public class DefaultConfigurableKeyedObjectPool extends Object implements ConfigurableKeyedObjectPool
ConfigurableKeyedObjectPool as a delegate of a KeyedPoolableObjectFactory
instance.WHEN_EXHAUSTED_BLOCK, WHEN_EXHAUSTED_FAIL, WHEN_EXHAUSTED_GROW| Constructor and Description |
|---|
DefaultConfigurableKeyedObjectPool() |
| Modifier and Type | Method and Description |
|---|---|
void |
addObject(Object key) |
Object |
borrowObject(Object key) |
void |
clear()
Clears the pool, removing all pooled instances.
|
void |
clear(Object key) |
void |
close() |
int |
getMaxActive()
Returns the cap on the number of active instances per key.
|
int |
getMaxIdle()
Returns the cap on the number of "idle" instances per key.
|
int |
getMaxTotal()
Returns the overall maximum number of objects (across pools) that can
exist at one time.
|
long |
getMaxWait()
Returns the maximum amount of time (in milliseconds) the
KeyedObjectPool.borrowObject(K) method should block before throwing
an exception when the pool is exhausted and the
"when exhausted" action is
ConfigurableKeyedObjectPool.WHEN_EXHAUSTED_BLOCK. |
int |
getNumActive() |
int |
getNumActive(Object key) |
int |
getNumIdle() |
int |
getNumIdle(Object key) |
byte |
getWhenExhaustedAction()
Returns the action to take when the
KeyedObjectPool.borrowObject(K) method
is invoked when the pool is exhausted. |
void |
invalidateObject(Object key,
Object obj) |
void |
returnObject(Object key,
Object obj) |
void |
setFactory(org.apache.commons.pool.KeyedPoolableObjectFactory factory) |
void |
setMaxActive(int maxActive)
Sets the cap on the number of active instances per key.
|
void |
setMaxIdle(int maxIdle)
Sets the cap on the number of "idle" instances in the pool.
|
void |
setMaxTotal(int maxTotal)
Sets the cap on the total number of instances from all pools combined.
|
void |
setMaxWait(long maxWait)
Sets the maximum amount of time (in milliseconds) the
KeyedObjectPool.borrowObject(K) method should block before throwing
an exception when the pool is exhausted and the
"when exhausted" action is
ConfigurableKeyedObjectPool.WHEN_EXHAUSTED_BLOCK. |
void |
setWhenExhaustedAction(byte whenExhaustedAction)
Sets the action to take when the
KeyedObjectPool.borrowObject(K) method
is invoked when the pool is exhausted. |
public Object borrowObject(Object key) throws Exception, NoSuchElementException, IllegalStateException
borrowObject in interface org.apache.commons.pool.KeyedObjectPoolExceptionNoSuchElementExceptionIllegalStateExceptionpublic void returnObject(Object key, Object obj) throws Exception
returnObject in interface org.apache.commons.pool.KeyedObjectPoolExceptionpublic void invalidateObject(Object key, Object obj) throws Exception
invalidateObject in interface org.apache.commons.pool.KeyedObjectPoolExceptionpublic void addObject(Object key) throws Exception, IllegalStateException, UnsupportedOperationException
addObject in interface org.apache.commons.pool.KeyedObjectPoolExceptionIllegalStateExceptionUnsupportedOperationExceptionpublic int getNumIdle(Object key) throws UnsupportedOperationException
getNumIdle in interface org.apache.commons.pool.KeyedObjectPoolUnsupportedOperationExceptionpublic int getNumActive(Object key) throws UnsupportedOperationException
getNumActive in interface org.apache.commons.pool.KeyedObjectPoolUnsupportedOperationExceptionpublic int getNumIdle()
throws UnsupportedOperationException
getNumIdle in interface org.apache.commons.pool.KeyedObjectPoolUnsupportedOperationExceptionpublic int getNumActive()
throws UnsupportedOperationException
getNumActive in interface org.apache.commons.pool.KeyedObjectPoolUnsupportedOperationExceptionpublic void clear()
ConfigurableKeyedObjectPoolclear in interface org.apache.commons.pool.KeyedObjectPoolclear in interface ConfigurableKeyedObjectPoolpublic void clear(Object key) throws Exception, UnsupportedOperationException
clear in interface org.apache.commons.pool.KeyedObjectPoolExceptionUnsupportedOperationExceptionpublic void close()
throws Exception
close in interface org.apache.commons.pool.KeyedObjectPoolExceptionpublic void setFactory(org.apache.commons.pool.KeyedPoolableObjectFactory factory)
throws IllegalStateException,
UnsupportedOperationException
setFactory in interface org.apache.commons.pool.KeyedObjectPoolIllegalStateExceptionUnsupportedOperationExceptionpublic int getMaxActive()
ConfigurableKeyedObjectPoolgetMaxActive in interface ConfigurableKeyedObjectPoolpublic int getMaxTotal()
ConfigurableKeyedObjectPoolgetMaxTotal in interface ConfigurableKeyedObjectPoolpublic void setMaxWait(long maxWait)
ConfigurableKeyedObjectPoolKeyedObjectPool.borrowObject(K) method should block before throwing
an exception when the pool is exhausted and the
"when exhausted" action is
ConfigurableKeyedObjectPool.WHEN_EXHAUSTED_BLOCK.
When less than or equal to 0, the KeyedObjectPool.borrowObject(K) method
may block indefinitely.setMaxWait in interface ConfigurableKeyedObjectPoolmaxWait - the maximum number of milliseconds borrowObject will block or negative for indefinitely.public void setMaxActive(int maxActive)
ConfigurableKeyedObjectPoolsetMaxActive in interface ConfigurableKeyedObjectPoolmaxActive - The cap on the number of active instances per key.
Use a negative value for no limit.public void setMaxIdle(int maxIdle)
ConfigurableKeyedObjectPoolsetMaxIdle in interface ConfigurableKeyedObjectPoolmaxIdle - the maximum number of "idle" instances that can be held
in a given keyed pool. Use a negative value for no limit.public void setMaxTotal(int maxTotal)
ConfigurableKeyedObjectPoolsetMaxTotal in interface ConfigurableKeyedObjectPoolmaxTotal - The cap on the total number of instances across pools.
Use a negative value for no limit.public int getMaxIdle()
ConfigurableKeyedObjectPoolgetMaxIdle in interface ConfigurableKeyedObjectPoolpublic void setWhenExhaustedAction(byte whenExhaustedAction)
ConfigurableKeyedObjectPoolKeyedObjectPool.borrowObject(K) method
is invoked when the pool is exhausted.setWhenExhaustedAction in interface ConfigurableKeyedObjectPoolwhenExhaustedAction - the action code, which must be one of
ConfigurableKeyedObjectPool.WHEN_EXHAUSTED_BLOCK, ConfigurableKeyedObjectPool.WHEN_EXHAUSTED_FAIL,
or ConfigurableKeyedObjectPool.WHEN_EXHAUSTED_GROWpublic byte getWhenExhaustedAction()
ConfigurableKeyedObjectPoolKeyedObjectPool.borrowObject(K) method
is invoked when the pool is exhausted.getWhenExhaustedAction in interface ConfigurableKeyedObjectPoolConfigurableKeyedObjectPool.WHEN_EXHAUSTED_BLOCK,
ConfigurableKeyedObjectPool.WHEN_EXHAUSTED_FAIL or ConfigurableKeyedObjectPool.WHEN_EXHAUSTED_GROWpublic long getMaxWait()
ConfigurableKeyedObjectPoolKeyedObjectPool.borrowObject(K) method should block before throwing
an exception when the pool is exhausted and the
"when exhausted" action is
ConfigurableKeyedObjectPool.WHEN_EXHAUSTED_BLOCK.
When less than or equal to 0, the KeyedObjectPool.borrowObject(K) method
may block indefinitely.getMaxWait in interface ConfigurableKeyedObjectPoolCopyright © 2003–2015 MuleSoft, Inc.. All rights reserved.