Save This Page
Home » spring-framework-2.5.5-with-dependencies » org.springframework » aop » target » [javadoc | source]
org.springframework.aop.target
public class: CommonsPoolTargetSource [javadoc | source]
java.lang.Object
   org.springframework.aop.target.AbstractBeanFactoryBasedTargetSource
      org.springframework.aop.target.AbstractPrototypeBasedTargetSource
         org.springframework.aop.target.AbstractPoolingTargetSource
            org.springframework.aop.target.CommonsPoolTargetSource

All Implemented Interfaces:
    PoolableObjectFactory, DisposableBean, PoolingConfig, TargetSource, BeanFactoryAware, Serializable

TargetSource implementation that holds objects in a configurable Jakarta Commons Pool.

By default, an instance of GenericObjectPool is created. Subclasses may change the type of ObjectPool used by overriding the createObjectPool() method.

Provides many configuration properties mirroring those of the Commons Pool GenericObjectPool class; these properties are passed to the GenericObjectPool during construction. If creating a subclass of this class to change the ObjectPool implementation type, pass in the values of configuration properties that are relevant to your chosen implementation.

The testOnBorrow, testOnReturn and testWhileIdle properties are explictly not mirrored because the implementation of PoolableObjectFactory used by this class does not implement meaningful validation. All exposed Commons Pool properties use the corresponding Commons Pool defaults: for example,

Fields inherited from org.springframework.aop.target.AbstractBeanFactoryBasedTargetSource:
logger
Constructor:
 public CommonsPoolTargetSource() 
Method from org.springframework.aop.target.CommonsPoolTargetSource Summary:
activateObject,   createObjectPool,   createPool,   destroy,   destroyObject,   getActiveCount,   getIdleCount,   getMaxIdle,   getMaxWait,   getMinEvictableIdleTimeMillis,   getMinIdle,   getTarget,   getTimeBetweenEvictionRunsMillis,   getWhenExhaustedAction,   makeObject,   passivateObject,   releaseTarget,   setMaxIdle,   setMaxWait,   setMinEvictableIdleTimeMillis,   setMinIdle,   setTimeBetweenEvictionRunsMillis,   setWhenExhaustedAction,   setWhenExhaustedActionName,   validateObject
Methods from org.springframework.aop.target.AbstractPoolingTargetSource:
createPool,   getMaxSize,   getPoolingConfigMixin,   getTarget,   releaseTarget,   setBeanFactory,   setMaxSize
Methods from org.springframework.aop.target.AbstractPrototypeBasedTargetSource:
destroyPrototypeInstance,   newPrototypeInstance,   setBeanFactory
Methods from org.springframework.aop.target.AbstractBeanFactoryBasedTargetSource:
copyFrom,   equals,   getBeanFactory,   getTargetBeanName,   getTargetClass,   hashCode,   isStatic,   releaseTarget,   setBeanFactory,   setTargetBeanName,   setTargetClass,   toString,   writeReplace
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.springframework.aop.target.CommonsPoolTargetSource Detail:
 public  void activateObject(Object obj) 
 protected ObjectPool createObjectPool() 
    Subclasses can override this if they want to return a specific Commons pool. They should apply any configuration properties to the pool here.

    Default is a GenericObjectPool instance with the given pool size.

 protected final  void createPool() 
    Creates and holds an ObjectPool instance.
 public  void destroy() throws Exception 
    Closes the underlying ObjectPool when destroying this object.
 public  void destroyObject(Object obj) throws Exception 
 public int getActiveCount() throws UnsupportedOperationException 
 public int getIdleCount() throws UnsupportedOperationException 
 public int getMaxIdle() 
    Return the maximum number of idle objects in the pool.
 public long getMaxWait() 
    Return the maximum waiting time for fetching an object from the pool.
 public long getMinEvictableIdleTimeMillis() 
    Return the minimum time that an idle object can sit in the pool.
 public int getMinIdle() 
    Return the minimum number of idle objects in the pool.
 public Object getTarget() throws Exception 
    Borrow an object from the ObjectPool.
 public long getTimeBetweenEvictionRunsMillis() 
    Return the time between eviction runs that check idle objects.
 public byte getWhenExhaustedAction() 
    Return the action to take when the pool is exhausted.
 public Object makeObject() throws BeansException 
 public  void passivateObject(Object obj) 
 public  void releaseTarget(Object target) throws Exception 
    Returns the specified object to the underlying ObjectPool.
 public  void setMaxIdle(int maxIdle) 
    Set the maximum number of idle objects in the pool. Default is 8.
 public  void setMaxWait(long maxWait) 
    Set the maximum waiting time for fetching an object from the pool. Default is -1, waiting forever.
 public  void setMinEvictableIdleTimeMillis(long minEvictableIdleTimeMillis) 
    Set the minimum time that an idle object can sit in the pool before it becomes subject to eviction. Default is 1800000 (30 minutes).

    Note that eviction runs need to be performed to take this setting into effect.

 public  void setMinIdle(int minIdle) 
    Set the minimum number of idle objects in the pool. Default is 0.
 public  void setTimeBetweenEvictionRunsMillis(long timeBetweenEvictionRunsMillis) 
    Set the time between eviction runs that check idle objects whether they have been idle for too long or have become invalid. Default is -1, not performing any eviction.
 public  void setWhenExhaustedAction(byte whenExhaustedAction) 
    Set the action to take when the pool is exhausted. Uses the constant values defined in Commons Pool's GenericObjectPool class.
 public  void setWhenExhaustedActionName(String whenExhaustedActionName) 
    Set the action to take when the pool is exhausted. Uses the constant names defined in Commons Pool's GenericObjectPool class: "WHEN_EXHAUSTED_BLOCK", "WHEN_EXHAUSTED_FAIL", "WHEN_EXHAUSTED_GROW".
 public boolean validateObject(Object obj)