org.mule.transport
Class DefaultConfigurableKeyedObjectPool

java.lang.Object
  extended by org.mule.transport.DefaultConfigurableKeyedObjectPool
All Implemented Interfaces:
org.apache.commons.pool.KeyedObjectPool, ConfigurableKeyedObjectPool

public class DefaultConfigurableKeyedObjectPool
extends Object
implements ConfigurableKeyedObjectPool

Implements ConfigurableKeyedObjectPool as a delegate of a KeyedPoolableObjectFactory instance.


Field Summary
 
Fields inherited from interface org.mule.transport.ConfigurableKeyedObjectPool
WHEN_EXHAUSTED_BLOCK, WHEN_EXHAUSTED_FAIL, WHEN_EXHAUSTED_GROW
 
Constructor Summary
DefaultConfigurableKeyedObjectPool()
           
 
Method Summary
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultConfigurableKeyedObjectPool

public DefaultConfigurableKeyedObjectPool()
Method Detail

borrowObject

public Object borrowObject(Object key)
                    throws Exception,
                           NoSuchElementException,
                           IllegalStateException
Specified by:
borrowObject in interface org.apache.commons.pool.KeyedObjectPool
Throws:
Exception
NoSuchElementException
IllegalStateException

returnObject

public void returnObject(Object key,
                         Object obj)
                  throws Exception
Specified by:
returnObject in interface org.apache.commons.pool.KeyedObjectPool
Throws:
Exception

invalidateObject

public void invalidateObject(Object key,
                             Object obj)
                      throws Exception
Specified by:
invalidateObject in interface org.apache.commons.pool.KeyedObjectPool
Throws:
Exception

addObject

public void addObject(Object key)
               throws Exception,
                      IllegalStateException,
                      UnsupportedOperationException
Specified by:
addObject in interface org.apache.commons.pool.KeyedObjectPool
Throws:
Exception
IllegalStateException
UnsupportedOperationException

getNumIdle

public int getNumIdle(Object key)
               throws UnsupportedOperationException
Specified by:
getNumIdle in interface org.apache.commons.pool.KeyedObjectPool
Throws:
UnsupportedOperationException

getNumActive

public int getNumActive(Object key)
                 throws UnsupportedOperationException
Specified by:
getNumActive in interface org.apache.commons.pool.KeyedObjectPool
Throws:
UnsupportedOperationException

getNumIdle

public int getNumIdle()
               throws UnsupportedOperationException
Specified by:
getNumIdle in interface org.apache.commons.pool.KeyedObjectPool
Throws:
UnsupportedOperationException

getNumActive

public int getNumActive()
                 throws UnsupportedOperationException
Specified by:
getNumActive in interface org.apache.commons.pool.KeyedObjectPool
Throws:
UnsupportedOperationException

clear

public void clear()
Description copied from interface: ConfigurableKeyedObjectPool
Clears the pool, removing all pooled instances.

Specified by:
clear in interface org.apache.commons.pool.KeyedObjectPool
Specified by:
clear in interface ConfigurableKeyedObjectPool

clear

public void clear(Object key)
           throws Exception,
                  UnsupportedOperationException
Specified by:
clear in interface org.apache.commons.pool.KeyedObjectPool
Throws:
Exception
UnsupportedOperationException

close

public void close()
           throws Exception
Specified by:
close in interface org.apache.commons.pool.KeyedObjectPool
Throws:
Exception

setFactory

public void setFactory(org.apache.commons.pool.KeyedPoolableObjectFactory factory)
                throws IllegalStateException,
                       UnsupportedOperationException
Specified by:
setFactory in interface org.apache.commons.pool.KeyedObjectPool
Throws:
IllegalStateException
UnsupportedOperationException

getMaxActive

public int getMaxActive()
Description copied from interface: ConfigurableKeyedObjectPool
Returns the cap on the number of active instances per key. A negative value indicates no limit.

Specified by:
getMaxActive in interface ConfigurableKeyedObjectPool

getMaxTotal

public int getMaxTotal()
Description copied from interface: ConfigurableKeyedObjectPool
Returns the overall maximum number of objects (across pools) that can exist at one time. A negative value indicates no limit.

Specified by:
getMaxTotal in interface ConfigurableKeyedObjectPool

setMaxWait

public void setMaxWait(long maxWait)
Description copied from interface: ConfigurableKeyedObjectPool
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.

When less than or equal to 0, the KeyedObjectPool.borrowObject(K) method may block indefinitely.

Specified by:
setMaxWait in interface ConfigurableKeyedObjectPool
Parameters:
maxWait - the maximum number of milliseconds borrowObject will block or negative for indefinitely.

setMaxActive

public void setMaxActive(int maxActive)
Description copied from interface: ConfigurableKeyedObjectPool
Sets the cap on the number of active instances per key.

Specified by:
setMaxActive in interface ConfigurableKeyedObjectPool
Parameters:
maxActive - The cap on the number of active instances per key. Use a negative value for no limit.

setMaxIdle

public void setMaxIdle(int maxIdle)
Description copied from interface: ConfigurableKeyedObjectPool
Sets the cap on the number of "idle" instances in the pool.

Specified by:
setMaxIdle in interface ConfigurableKeyedObjectPool
Parameters:
maxIdle - the maximum number of "idle" instances that can be held in a given keyed pool. Use a negative value for no limit.

setMaxTotal

public void setMaxTotal(int maxTotal)
Description copied from interface: ConfigurableKeyedObjectPool
Sets the cap on the total number of instances from all pools combined.

Specified by:
setMaxTotal in interface ConfigurableKeyedObjectPool
Parameters:
maxTotal - The cap on the total number of instances across pools. Use a negative value for no limit.

getMaxIdle

public int getMaxIdle()
Description copied from interface: ConfigurableKeyedObjectPool
Returns the cap on the number of "idle" instances per key.

Specified by:
getMaxIdle in interface ConfigurableKeyedObjectPool

setWhenExhaustedAction

public void setWhenExhaustedAction(byte whenExhaustedAction)
Description copied from interface: ConfigurableKeyedObjectPool
Sets the action to take when the KeyedObjectPool.borrowObject(K) method is invoked when the pool is exhausted.

Specified by:
setWhenExhaustedAction in interface ConfigurableKeyedObjectPool
Parameters:
whenExhaustedAction - the action code, which must be one of ConfigurableKeyedObjectPool.WHEN_EXHAUSTED_BLOCK, ConfigurableKeyedObjectPool.WHEN_EXHAUSTED_FAIL, or ConfigurableKeyedObjectPool.WHEN_EXHAUSTED_GROW

getWhenExhaustedAction

public byte getWhenExhaustedAction()
Description copied from interface: ConfigurableKeyedObjectPool
Returns the action to take when the KeyedObjectPool.borrowObject(K) method is invoked when the pool is exhausted.

Specified by:
getWhenExhaustedAction in interface ConfigurableKeyedObjectPool
Returns:
one of ConfigurableKeyedObjectPool.WHEN_EXHAUSTED_BLOCK, ConfigurableKeyedObjectPool.WHEN_EXHAUSTED_FAIL or ConfigurableKeyedObjectPool.WHEN_EXHAUSTED_GROW

getMaxWait

public long getMaxWait()
Description copied from interface: ConfigurableKeyedObjectPool
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.

When less than or equal to 0, the KeyedObjectPool.borrowObject(K) method may block indefinitely.

Specified by:
getMaxWait in interface ConfigurableKeyedObjectPool


Copyright © 2003-2014 MuleSoft, Inc.. All Rights Reserved.