Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.commons.pool.impl
Class GenericObjectPoolFactory

    java.lang.Object
      org.apache.commons.pool.impl.GenericObjectPoolFactory

All Implemented Interfaces:
  ObjectPoolFactory

    public class GenericObjectPoolFactory

extends Object
implements ObjectPoolFactory

A factory for creating `GenericObjectPool` instances.

Since:
  Pool 1.0
Version:
  $Revision: 965326 $ $Date: 2010-07-18 16:49:04 -0700 (Sun, 18 Jul 2010) $
Author:
  Rodney Waldhoff
See Also:
  `GenericObjectPool`, `ObjectPoolFactory`

Field Summary
`protected PoolableObjectFactory` | `_factory` Deprecated. to be removed in pool 2.0. Use `getFactory()`.
`protected boolean` | `_lifo` Deprecated. to be removed in pool 2.0. Use `getLifo()`.
`protected int` | `_maxActive` Deprecated. to be removed in pool 2.0. Use `getMaxActive()`.
`protected int` | `_maxIdle` Deprecated. to be removed in pool 2.0. Use `getMaxIdle()`.
`protected long` | `_maxWait` Deprecated. to be removed in pool 2.0. Use `getMaxWait()`.
`protected long` | `_minEvictableIdleTimeMillis` Deprecated. to be removed in pool 2.0. Use `getMinEvictableIdleTimeMillis()`.
`protected int` | `_minIdle` Deprecated. to be removed in pool 2.0. Use `getMinIdle()`.
`protected int` | `_numTestsPerEvictionRun` Deprecated. to be removed in pool 2.0. Use `getNumTestsPerEvictionRun()`.
`protected long` | `_softMinEvictableIdleTimeMillis` Deprecated. to be removed in pool 2.0. Use `getSoftMinEvictableIdleTimeMillis()`.
`protected boolean` | `_testOnBorrow` Deprecated. to be removed in pool 2.0. Use `getTestOnBorrow()`.
`protected boolean` | `_testOnReturn` Deprecated. to be removed in pool 2.0. Use `getTestOnReturn()`.
`protected boolean` | `_testWhileIdle` Deprecated. to be removed in pool 2.0. Use `getTestWhileIdle()`.
`protected long` | `_timeBetweenEvictionRunsMillis` Deprecated. to be removed in pool 2.0. Use `getTimeBetweenEvictionRunsMillis()`.
`protected byte` | `_whenExhaustedAction` Deprecated. to be removed in pool 2.0. Use `getWhenExhaustedAction()`.

Constructor Summary
`GenericObjectPoolFactory(PoolableObjectFactory factory)` Create a new GenericObjectPoolFactory.
`GenericObjectPoolFactory(PoolableObjectFactory factory, GenericObjectPool.Config config)` Create a new GenericObjectPoolFactory.
`GenericObjectPoolFactory(PoolableObjectFactory factory, int maxActive)` Create a new GenericObjectPoolFactory.
`GenericObjectPoolFactory(PoolableObjectFactory factory, int maxActive, byte whenExhaustedAction, long maxWait)` Create a new GenericObjectPoolFactory.
`GenericObjectPoolFactory(PoolableObjectFactory factory, int maxActive, byte whenExhaustedAction, long maxWait, boolean testOnBorrow, boolean testOnReturn)` Create a new GenericObjectPoolFactory.
`GenericObjectPoolFactory(PoolableObjectFactory factory, int maxActive, byte whenExhaustedAction, long maxWait, int maxIdle)` Create a new GenericObjectPoolFactory.
`GenericObjectPoolFactory(PoolableObjectFactory factory, int maxActive, byte whenExhaustedAction, long maxWait, int maxIdle, boolean testOnBorrow, boolean testOnReturn)` Create a new GenericObjectPoolFactory.
`GenericObjectPoolFactory(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 GenericObjectPoolFactory.
`GenericObjectPoolFactory(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 GenericObjectPoolFactory.
`GenericObjectPoolFactory(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)` Create a new GenericObjectPoolFactory.
`GenericObjectPoolFactory(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 GenericObjectPoolFactory.

Method Summary
`ObjectPool` | `createPool()` Create and return a new `ObjectPool`.
`PoolableObjectFactory` | `getFactory()`
`boolean` | `getLifo()`
`int` | `getMaxActive()`
`int` | `getMaxIdle()`
`long` | `getMaxWait()`
`long` | `getMinEvictableIdleTimeMillis()`
`int` | `getMinIdle()`
`int` | `getNumTestsPerEvictionRun()`
`long` | `getSoftMinEvictableIdleTimeMillis()`
`boolean` | `getTestOnBorrow()`
`boolean` | `getTestOnReturn()`
`boolean` | `getTestWhileIdle()`
`long` | `getTimeBetweenEvictionRunsMillis()`
`byte` | `getWhenExhaustedAction()`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### _maxIdle

    protected int _maxIdle

  Deprecated. to be removed in pool 2.0. Use `getMaxIdle()`.
  The `maxIdle` setting for pools created by this factory.

### _minIdle

    protected int _minIdle

  Deprecated. to be removed in pool 2.0. Use `getMinIdle()`.
  The `minIdle` setting for pools created by this factory.

### _maxActive

    protected int _maxActive

  Deprecated. to be removed in pool 2.0. Use `getMaxActive()`.
  The `maxActive` setting for pools created by this factory.

### _maxWait

    protected long _maxWait

  Deprecated. to be removed in pool 2.0. Use `getMaxWait()`.
  The `maxWait` setting for pools created by this factory.

### _whenExhaustedAction

    protected byte _whenExhaustedAction

  Deprecated. to be removed in pool 2.0. Use `getWhenExhaustedAction()`.
  The `whenExhaustedAction` setting for pools created by this factory.

### _testOnBorrow

    protected boolean _testOnBorrow

  Deprecated. to be removed in pool 2.0. Use `getTestOnBorrow()`.
  The `testOnBorrow` setting for pools created by this factory.

### _testOnReturn

    protected boolean _testOnReturn

  Deprecated. to be removed in pool 2.0. Use `getTestOnReturn()`.
  The `testOnReturn` setting for pools created by this factory.

### _testWhileIdle

    protected boolean _testWhileIdle

  Deprecated. to be removed in pool 2.0. Use `getTestWhileIdle()`.
  The `testWhileIdle` setting for pools created by this factory.

### _timeBetweenEvictionRunsMillis

    protected long _timeBetweenEvictionRunsMillis

  Deprecated. to be removed in pool 2.0. Use `getTimeBetweenEvictionRunsMillis()`.
  The `timeBetweenEvictionRunsMillis` setting for pools created by this factory.

### _numTestsPerEvictionRun

    protected int _numTestsPerEvictionRun

  Deprecated. to be removed in pool 2.0. Use `getNumTestsPerEvictionRun()`.
  The `numTestsPerEvictionRun` setting for pools created by this factory.

### _minEvictableIdleTimeMillis

    protected long _minEvictableIdleTimeMillis

  Deprecated. to be removed in pool 2.0. Use `getMinEvictableIdleTimeMillis()`.
  The `minEvictableIdleTimeMillis` setting for pools created by this factory.

### _softMinEvictableIdleTimeMillis

    protected long _softMinEvictableIdleTimeMillis

  Deprecated. to be removed in pool 2.0. Use `getSoftMinEvictableIdleTimeMillis()`.
  The `softMinEvictableIdleTimeMillis` setting for pools created by this factory.

### _lifo

    protected boolean _lifo

  Deprecated. to be removed in pool 2.0. Use `getLifo()`.
  The `lifo` setting for pools created by this factory.

### _factory

    protected PoolableObjectFactory _factory

  Deprecated. to be removed in pool 2.0. Use `getFactory()`.
  The `PoolableObjectFactory` used by pools created by this factory.

Constructor Detail

### GenericObjectPoolFactory

    public GenericObjectPoolFactory(PoolableObjectFactory factory)

  Create a new GenericObjectPoolFactory.

  Parameters:
    `factory` - the PoolableObjectFactory used by created pools.
  See Also:
    `GenericObjectPool.GenericObjectPool(PoolableObjectFactory)`

### GenericObjectPoolFactory

    public GenericObjectPoolFactory(PoolableObjectFactory factory,
                                    GenericObjectPool.Config config)
                             throws NullPointerException

  Create a new GenericObjectPoolFactory.

  Parameters:
    `factory` - the PoolableObjectFactory used by created pools.
    `config` - a non-`null` GenericObjectPool.Config describing the configuration.
  Throws:
    `NullPointerException` - when config is `null`.
  See Also:
    `GenericObjectPool.GenericObjectPool(PoolableObjectFactory, GenericObjectPool.Config)`

### GenericObjectPoolFactory

    public GenericObjectPoolFactory(PoolableObjectFactory factory,
                                    int maxActive)

  Create a new GenericObjectPoolFactory.

  Parameters:
    `factory` - the PoolableObjectFactory used by created pools.
    `maxActive` - maximum number of objects that can be borrowed from created pools at one time.
  See Also:
    `GenericObjectPool.GenericObjectPool(PoolableObjectFactory, int)`

### GenericObjectPoolFactory

    public GenericObjectPoolFactory(PoolableObjectFactory factory,
                                    int maxActive,
                                    byte whenExhaustedAction,
                                    long maxWait)

  Create a new GenericObjectPoolFactory.

  Parameters:
    `factory` - the PoolableObjectFactory used by created pools.
    `maxActive` - maximum number of objects that can be borrowed from created pools at one time.
    `whenExhaustedAction` - the action to take when the pool is exhausted.
    `maxWait` - the maximum amount of time to wait for an idle object when the pool is exhausted.
  See Also:
    `GenericObjectPool.GenericObjectPool(PoolableObjectFactory, int, byte, long)`

### GenericObjectPoolFactory

    public GenericObjectPoolFactory(PoolableObjectFactory factory,
                                    int maxActive,
                                    byte whenExhaustedAction,
                                    long maxWait,
                                    boolean testOnBorrow,
                                    boolean testOnReturn)

  Create a new GenericObjectPoolFactory.

  Parameters:
    `factory` - the PoolableObjectFactory used by created pools.
    `maxActive` - maximum number of objects that can be borrowed from created pools at one time.
    `whenExhaustedAction` - the action to take when the pool is exhausted.
    `maxWait` - the maximum amount of time to wait for an idle object when the pool is exhausted.
    `testOnBorrow` - whether to validate objects before they are returned by the borrowObject.
    `testOnReturn` - whether to validate objects after they are returned to the returnObject.
  See Also:
    `GenericObjectPool.GenericObjectPool(PoolableObjectFactory, int, byte, long, boolean, boolean)`

### GenericObjectPoolFactory

    public GenericObjectPoolFactory(PoolableObjectFactory factory,
                                    int maxActive,
                                    byte whenExhaustedAction,
                                    long maxWait,
                                    int maxIdle)

  Create a new GenericObjectPoolFactory.

  Parameters:
    `factory` - the PoolableObjectFactory used by created pools.
    `maxActive` - maximum number of objects that can be borrowed from created pools at one time.
    `whenExhaustedAction` - the action to take when the pool is exhausted.
    `maxWait` - the maximum amount of time to wait for an idle object when the pool is exhausted.
    `maxIdle` - the maximum number of idle objects in my pool.
  See Also:
    `GenericObjectPool.GenericObjectPool(PoolableObjectFactory, int, byte, long, int)`

### GenericObjectPoolFactory

    public GenericObjectPoolFactory(PoolableObjectFactory factory,
                                    int maxActive,
                                    byte whenExhaustedAction,
                                    long maxWait,
                                    int maxIdle,
                                    boolean testOnBorrow,
                                    boolean testOnReturn)

  Create a new GenericObjectPoolFactory.

  Parameters:
    `factory` - the PoolableObjectFactory used by created pools.
    `maxActive` - maximum number of objects that can be borrowed from created pools at one time.
    `whenExhaustedAction` - the action to take when the pool is exhausted.
    `maxWait` - the maximum amount of time to wait for an idle object when the pool is exhausted.
    `maxIdle` - the maximum number of idle objects in my pool.
    `testOnBorrow` - whether to validate objects before they are returned by the borrowObject.
    `testOnReturn` - whether to validate objects after they are returned to the returnObject.
  See Also:
    `GenericObjectPool.GenericObjectPool(PoolableObjectFactory, int, byte, long, int, boolean, boolean)`

### GenericObjectPoolFactory

    public GenericObjectPoolFactory(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 GenericObjectPoolFactory.

  Parameters:
    `factory` - the PoolableObjectFactory used by created pools.
    `maxActive` - maximum number of objects that can be borrowed from created pools at one time.
    `whenExhaustedAction` - the action to take when the pool is exhausted.
    `maxWait` - the maximum amount of time to wait for an idle object when the pool is exhausted.
    `maxIdle` - the maximum number of idle objects in my pool.
    `testOnBorrow` - whether to validate objects before they are returned by the borrowObject.
    `testOnReturn` - whether to validate objects after they are returned to the returnObject.
    `timeBetweenEvictionRunsMillis` - the number of milliseconds to sleep between examining idle objects for eviction.
    `numTestsPerEvictionRun` - the number of idle objects to examine per run within the idle object eviction thread.
    `minEvictableIdleTimeMillis` - the minimum number of milliseconds an object can sit idle in the pool before it is eligible for eviction.
    `testWhileIdle` - whether or not to validate objects in the idle object eviction thread.
  See Also:
    `GenericObjectPool.GenericObjectPool(PoolableObjectFactory, int, byte, long, int, boolean, boolean, long, int, long, boolean)`

### GenericObjectPoolFactory

    public GenericObjectPoolFactory(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 GenericObjectPoolFactory.

  Parameters:
    `factory` - the PoolableObjectFactory used by created pools.
    `maxActive` - maximum number of objects that can be borrowed from created pools at one time.
    `whenExhaustedAction` - the action to take when the pool is exhausted.
    `maxWait` - the maximum amount of time to wait for an idle object when the pool is exhausted.
    `maxIdle` - the maximum number of idle objects in my pool.
    `minIdle` - the minimum number of idle objects in my pool.
    `testOnBorrow` - whether to validate objects before they are returned by the borrowObject.
    `testOnReturn` - whether to validate objects after they are returned to the returnObject.
    `timeBetweenEvictionRunsMillis` - the number of milliseconds to sleep between examining idle objects for eviction.
    `numTestsPerEvictionRun` - the number of idle objects to examine per run within the idle object eviction thread.
    `minEvictableIdleTimeMillis` - the minimum number of milliseconds an object can sit idle in the pool before it is eligible for eviction.
    `testWhileIdle` - whether or not to validate objects in the idle object eviction thread.
  See Also:
    `GenericObjectPool.GenericObjectPool(PoolableObjectFactory, int, byte, long, int, int, boolean, boolean, long, int, long, boolean)`

### GenericObjectPoolFactory

    public GenericObjectPoolFactory(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)

  Create a new GenericObjectPoolFactory.

  Parameters:
    `factory` - the PoolableObjectFactory used by created pools.
    `maxActive` - maximum number of objects that can be borrowed from created pools at one time.
    `whenExhaustedAction` - the action to take when the pool is exhausted.
    `maxWait` - the maximum amount of time to wait for an idle object when the pool is exhausted.
    `maxIdle` - the maximum number of idle objects in my pool.
    `minIdle` - the minimum number of idle objects in my pool.
    `testOnBorrow` - whether to validate objects before they are returned by the borrowObject.
    `testOnReturn` - whether to validate objects after they are returned to the returnObject.
    `timeBetweenEvictionRunsMillis` - the number of milliseconds to sleep between examining idle objects for eviction.
    `numTestsPerEvictionRun` - the number of idle objects to examine per run within the idle object eviction thread.
    `minEvictableIdleTimeMillis` - the minimum number of milliseconds an object can sit idle in the pool before it is eligible for eviction.
    `testWhileIdle` - whether or not to validate objects in the idle object eviction thread.
    `softMinEvictableIdleTimeMillis` - the minimum number of milliseconds an object can sit idle in the pool before it is eligible for eviction with the extra condition that at least "minIdle" amount of object remain in the pool.
  Since:
    Pool 1.3
  See Also:
    `GenericObjectPool.GenericObjectPool(PoolableObjectFactory, int, byte, long, int, int, boolean, boolean, long, int, long, boolean, long)`

### GenericObjectPoolFactory

    public GenericObjectPoolFactory(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 GenericObjectPoolFactory.

  Parameters:
    `factory` - the PoolableObjectFactory used by created pools.
    `maxActive` - maximum number of objects that can be borrowed from created pools at one time.
    `whenExhaustedAction` - the action to take when the pool is exhausted.
    `maxWait` - the maximum amount of time to wait for an idle object when the pool is exhausted.
    `maxIdle` - the maximum number of idle objects in my pool.
    `minIdle` - the minimum number of idle objects in my pool.
    `testOnBorrow` - whether to validate objects before they are returned by the borrowObject.
    `testOnReturn` - whether to validate objects after they are returned to the returnObject.
    `timeBetweenEvictionRunsMillis` - the number of milliseconds to sleep between examining idle objects for eviction.
    `numTestsPerEvictionRun` - the number of idle objects to examine per run within the idle object eviction thread.
    `minEvictableIdleTimeMillis` - the minimum number of milliseconds an object can sit idle in the pool before it is eligible for eviction.
    `testWhileIdle` - whether or not to validate objects in the idle object eviction thread.
    `softMinEvictableIdleTimeMillis` - the minimum number of milliseconds an object can sit idle in the pool before it is eligible for eviction with the extra condition that at least "minIdle" amount of object remain in the pool.
    `lifo` - whether or not objects are returned in last-in-first-out order from the idle object pool.
  Since:
    Pool 1.4
  See Also:
    `GenericObjectPool.GenericObjectPool(PoolableObjectFactory, int, byte, long, int, int, boolean, boolean, long, int, long, boolean, long, boolean)`

Method Detail

### createPool

    public ObjectPool createPool()

  Create and return a new `ObjectPool`.

  Specified by:
    `createPool` in interface `ObjectPoolFactory`
  Returns:
    a new `ObjectPool`

### getMaxIdle

    public int getMaxIdle()

  Returns:
    the `maxIdle` setting for pools created by this factory.
  Since:
    1.5.5

### getMinIdle

    public int getMinIdle()

  Returns:
    the `minIdle` setting for pools created by this factory.
  Since:
    1.5.5

### getMaxActive

    public int getMaxActive()

  Returns:
    the `maxActive` setting for pools created by this factory.
  Since:
    1.5.5

### getMaxWait

    public long getMaxWait()

  Returns:
    the `maxWait` setting for pools created by this factory.
  Since:
    1.5.5

### getWhenExhaustedAction

    public byte getWhenExhaustedAction()

  Returns:
    the `whenExhaustedAction` setting for pools created by this factory.
  Since:
    1.5.5

### getTestOnBorrow

    public boolean getTestOnBorrow()

  Returns:
    the `testOnBorrow` setting for pools created by this factory.
  Since:
    1.5.5

### getTestOnReturn

    public boolean getTestOnReturn()

  Returns:
    the `testOnReturn` setting for pools created by this factory.
  Since:
    1.5.5

### getTestWhileIdle

    public boolean getTestWhileIdle()

  Returns:
    the `testWhileIdle` setting for pools created by this factory.
  Since:
    1.5.5

### getTimeBetweenEvictionRunsMillis

    public long getTimeBetweenEvictionRunsMillis()

  Returns:
    the `timeBetweenEvictionRunsMillis` setting for pools created by this factory.
  Since:
    1.5.5

### getNumTestsPerEvictionRun

    public int getNumTestsPerEvictionRun()

  Returns:
    the `numTestsPerEvictionRun` setting for pools created by this factory.
  Since:
    1.5.5

### getMinEvictableIdleTimeMillis

    public long getMinEvictableIdleTimeMillis()

  Returns:
    the `minEvictableIdleTimeMillis` setting for pools created by this factory.
  Since:
    1.5.5

### getSoftMinEvictableIdleTimeMillis

    public long getSoftMinEvictableIdleTimeMillis()

  Returns:
    the `softMinEvicatableIdleTimeMillis` setting for pools created by this factory.
  Since:
    1.5.5

### getLifo

    public boolean getLifo()

  Returns:
    the `lifo` setting for pools created by this factory.
  Since:
    1.5.5

### getFactory

    public PoolableObjectFactory getFactory()

  Returns:
    the `PoolableObjectFactory` used by pools created by this factory

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2001-2011 The Apache Software Foundation. All Rights Reserved.