Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Licensed to the Apache Software Foundation (ASF) under one or more
   * contributor license agreements.  See the NOTICE file distributed with
   * this work for additional information regarding copyright ownership.
   * The ASF licenses this file to You under the Apache License, Version 2.0
   * (the "License"); you may not use this file except in compliance with
   * the License.  You may obtain a copy of the License at
   *
   *      http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
 
 package org.apache.commons.pool.impl;
 
A factory for creating GenericKeyedObjectPool instances.

Parameters:
<K> the type of keys in this pool
<V> the type of objects held in this pool
Author(s):
Rodney Waldhoff
Dirk Verbeeck
Version:
$Revision: 1222396 $ $Date: 2011-12-22 14:02:25 -0500 (Thu, 22 Dec 2011) $
Since:
Pool 1.0
See also:
GenericKeyedObjectPool
org.apache.commons.pool.KeyedObjectPoolFactory
 
 public class GenericKeyedObjectPoolFactory<K, V> implements KeyedObjectPoolFactory<K, V> {
    
Create a new GenericKeyedObjectPoolFactory.

Parameters:
factory the KeyedPoolableObjectFactory to used by created pools.
See also:
GenericKeyedObjectPool.GenericKeyedObjectPool.(org.apache.commons.pool.KeyedPoolableObjectFactory)
 
     public GenericKeyedObjectPoolFactory(KeyedPoolableObjectFactory<K, V> factory) {
     }

    
Create a new GenericKeyedObjectPoolFactory.

Parameters:
factory the KeyedPoolableObjectFactory to used by created pools.
config a non-null GenericKeyedObjectPool.Config describing the configuration.
Throws:
java.lang.NullPointerException when config is null.
See also:
GenericKeyedObjectPool.GenericKeyedObjectPool.(org.apache.commons.pool.KeyedPoolableObjectFactory,org.apache.commons.pool.impl.GenericKeyedObjectPool.Config)
 
         this(factory,config.maxActive,config.whenExhaustedAction,config.maxWait,config.maxIdle,config.maxTotal,config.minIdle,config.testOnBorrow,config.testOnReturn,config.timeBetweenEvictionRunsMillis,config.numTestsPerEvictionRun,config.minEvictableIdleTimeMillis,config.testWhileIdle,config.lifo);
     }

    
Create a new GenericKeyedObjectPoolFactory.

Parameters:
factory the KeyedPoolableObjectFactory to used by created pools.
maxActive the maximum number of objects that can be borrowed from pools at one time.
See also:
GenericKeyedObjectPool.GenericKeyedObjectPool.(org.apache.commons.pool.KeyedPoolableObjectFactory,int)
 
     public GenericKeyedObjectPoolFactory(KeyedPoolableObjectFactory<K, V> factoryint maxActive) {
     }

    
Create a new GenericKeyedObjectPoolFactory.

Parameters:
factory the KeyedPoolableObjectFactory to used by created pools.
maxActive the maximum number of objects that can be borrowed from 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:
GenericKeyedObjectPool.GenericKeyedObjectPool.(org.apache.commons.pool.KeyedPoolableObjectFactory,int,byte,long)
 
     public GenericKeyedObjectPoolFactory(KeyedPoolableObjectFactory<K, V> factoryint maxActivebyte whenExhaustedActionlong maxWait) {
     }

    
Create a new GenericKeyedObjectPoolFactory.

Parameters:
factory the KeyedPoolableObjectFactory to used by created pools.
maxActive the maximum number of objects that can be borrowed from 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 borrowObject.
testOnReturn whether to validate objects after they are returned to returnObject.
See also:
GenericKeyedObjectPool.GenericKeyedObjectPool.(org.apache.commons.pool.KeyedPoolableObjectFactory,int,byte,long,boolean,boolean)
 
     public GenericKeyedObjectPoolFactory(KeyedPoolableObjectFactory<K, V> factoryint maxActivebyte whenExhaustedActionlong maxWaitboolean testOnBorrowboolean testOnReturn) {
     }

    
Create a new GenericKeyedObjectPoolFactory.

Parameters:
factory the KeyedPoolableObjectFactory to used by created pools.
maxActive the maximum number of objects that can be borrowed from 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 the pools.
See also:
GenericKeyedObjectPool.GenericKeyedObjectPool.(org.apache.commons.pool.KeyedPoolableObjectFactory,int,byte,long,int)
    public GenericKeyedObjectPoolFactory(KeyedPoolableObjectFactory<K, V> factoryint maxActivebyte whenExhaustedActionlong maxWaitint maxIdle) {
    }

    
Create a new GenericKeyedObjectPoolFactory.

Parameters:
factory the KeyedPoolableObjectFactory to used by created pools.
maxActive the maximum number of objects that can be borrowed from 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 the pools.
maxTotal the maximum number of objects that can exists at one time.
    public GenericKeyedObjectPoolFactory(KeyedPoolableObjectFactory<K, V> factoryint maxActivebyte whenExhaustedActionlong maxWaitint maxIdleint maxTotal) {
    }

    
Create a new GenericKeyedObjectPoolFactory.

Parameters:
factory the KeyedPoolableObjectFactory to used by created pools.
maxActive the maximum number of objects that can be borrowed from 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 the pools.
testOnBorrow whether to validate objects before they are returned by borrowObject.
testOnReturn whether to validate objects after they are returned to returnObject.
See also:
GenericKeyedObjectPool.GenericKeyedObjectPool.(org.apache.commons.pool.KeyedPoolableObjectFactory,int,byte,long,int,boolean,boolean)
    public GenericKeyedObjectPoolFactory(KeyedPoolableObjectFactory<K, V> factoryint maxActivebyte whenExhaustedActionlong maxWaitint maxIdleboolean testOnBorrowboolean testOnReturn) {
    }

    
Create a new GenericKeyedObjectPoolFactory.

Parameters:
factory the KeyedPoolableObjectFactory to used by created pools.
maxActive the maximum number of objects that can be borrowed from 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 the pools.
testOnBorrow whether to validate objects before they are returned by borrowObject.
testOnReturn whether to validate objects after they are returned to returnObject.
timeBetweenEvictionRunsMillis the number of milliseconds to sleep between examining idle objects for eviction.
numTestsPerEvictionRun the number of idle objects to examine per run of the evictor.
minEvictableIdleTimeMillis the minimum number of milliseconds an object can sit idle in the pool before it is eligible for eviction.
testWhileIdle whether to validate objects in the idle object eviction thread.
See also:
GenericKeyedObjectPool.GenericKeyedObjectPool.(org.apache.commons.pool.KeyedPoolableObjectFactory,int,byte,long,int,boolean,boolean,long,int,long,boolean)
    public GenericKeyedObjectPoolFactory(KeyedPoolableObjectFactory<K, V> factoryint maxActivebyte whenExhaustedActionlong maxWaitint maxIdleboolean testOnBorrowboolean testOnReturnlong timeBetweenEvictionRunsMillisint numTestsPerEvictionRunlong minEvictableIdleTimeMillisboolean testWhileIdle) {
        this(factorymaxActivewhenExhaustedActionmaxWaitmaxIdle.testOnBorrowtestOnReturntimeBetweenEvictionRunsMillisnumTestsPerEvictionRunminEvictableIdleTimeMillistestWhileIdle);
    }

    
Create a new GenericKeyedObjectPoolFactory.

Parameters:
factory the KeyedPoolableObjectFactory to used by created pools.
maxActive the maximum number of objects that can be borrowed from 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 the pools.
maxTotal the maximum number of objects that can exists at one time.
testOnBorrow whether to validate objects before they are returned by borrowObject.
testOnReturn whether to validate objects after they are returned to returnObject.
timeBetweenEvictionRunsMillis the number of milliseconds to sleep between examining idle objects for eviction.
numTestsPerEvictionRun the number of idle objects to examine per run of the evictor.
minEvictableIdleTimeMillis the minimum number of milliseconds an object can sit idle in the pool before it is eligible for eviction.
testWhileIdle whether to validate objects in the idle object eviction thread.
See also:
GenericKeyedObjectPool.GenericKeyedObjectPool.(org.apache.commons.pool.KeyedPoolableObjectFactory,int,byte,long,int,int,boolean,boolean,long,int,long,boolean)
    public GenericKeyedObjectPoolFactory(KeyedPoolableObjectFactory<K, V> factoryint maxActivebyte whenExhaustedActionlong maxWaitint maxIdleint maxTotalboolean testOnBorrowboolean testOnReturnlong timeBetweenEvictionRunsMillisint numTestsPerEvictionRunlong minEvictableIdleTimeMillisboolean testWhileIdle) {
        this(factorymaxActivewhenExhaustedActionmaxWaitmaxIdlemaxTotal. , testOnBorrowtestOnReturntimeBetweenEvictionRunsMillisnumTestsPerEvictionRunminEvictableIdleTimeMillistestWhileIdle);
    }

    
Create a new GenericKeyedObjectPoolFactory.

Parameters:
factory the KeyedPoolableObjectFactory to used by created pools.
maxActive the maximum number of objects that can be borrowed from 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 the pools.
maxTotal the maximum number of objects that can exists at one time.
minIdle the minimum number of idle objects to have in the pool at any one time.
testOnBorrow whether to validate objects before they are returned by borrowObject.
testOnReturn whether to validate objects after they are returned to returnObject.
timeBetweenEvictionRunsMillis the number of milliseconds to sleep between examining idle objects for eviction.
numTestsPerEvictionRun the number of idle objects to examine per run of the evictor.
minEvictableIdleTimeMillis the minimum number of milliseconds an object can sit idle in the pool before it is eligible for eviction.
testWhileIdle whether to validate objects in the idle object eviction thread.
Since:
Pool 1.3
See also:
GenericKeyedObjectPool.GenericKeyedObjectPool.(org.apache.commons.pool.KeyedPoolableObjectFactory,int,byte,long,int,int,int,boolean,boolean,long,int,long,boolean)
    public GenericKeyedObjectPoolFactory(KeyedPoolableObjectFactory<K, V> factoryint maxActivebyte whenExhaustedActionlong maxWaitint maxIdleint maxTotalint minIdleboolean testOnBorrowboolean testOnReturnlong timeBetweenEvictionRunsMillisint numTestsPerEvictionRunlong minEvictableIdleTimeMillisboolean testWhileIdle) {
        this(factorymaxActivewhenExhaustedActionmaxWaitmaxIdlemaxTotalminIdletestOnBorrowtestOnReturntimeBetweenEvictionRunsMillisnumTestsPerEvictionRunminEvictableIdleTimeMillistestWhileIdle.);
    }

    
Create a new GenericKeyedObjectPoolFactory.

Parameters:
factory the KeyedPoolableObjectFactory to used by created pools.
maxActive the maximum number of objects that can be borrowed from 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 the pools.
maxTotal the maximum number of objects that can exists at one time.
minIdle the minimum number of idle objects to have in the pool at any one time.
testOnBorrow whether to validate objects before they are returned by borrowObject.
testOnReturn whether to validate objects after they are returned to returnObject.
timeBetweenEvictionRunsMillis the number of milliseconds to sleep between examining idle objects for eviction.
numTestsPerEvictionRun the number of idle objects to examine per run of the evictor.
minEvictableIdleTimeMillis the minimum number of milliseconds an object can sit idle in the pool before it is eligible for eviction.
testWhileIdle whether to validate objects in the idle object eviction thread.
lifo whether or not objects are returned in last-in-first-out order from the idle object pool.
Since:
Pool 1.4
See also:
GenericKeyedObjectPool.GenericKeyedObjectPool.(org.apache.commons.pool.KeyedPoolableObjectFactory,int,byte,long,int,int,int,boolean,boolean,long,int,long,boolean,boolean)
    public GenericKeyedObjectPoolFactory(KeyedPoolableObjectFactory<K, V> factoryint maxActivebyte whenExhaustedActionlong maxWaitint maxIdleint maxTotalint minIdleboolean testOnBorrowboolean testOnReturnlong timeBetweenEvictionRunsMillisint numTestsPerEvictionRunlong minEvictableIdleTimeMillisboolean testWhileIdleboolean lifo) {
         = maxIdle;
         = maxActive;
         = maxTotal;
         = minIdle;
         = maxWait;
         = whenExhaustedAction;
         = testOnBorrow;
         = testOnReturn;
         = testWhileIdle;
         = timeBetweenEvictionRunsMillis;
         = numTestsPerEvictionRun;
         = minEvictableIdleTimeMillis;
         = factory;
         = lifo;
    }

    
Create a new GenericKeyedObjectPool with the currently configured properties.

Returns:
GenericKeyedObjectPool with Configuration determined by current property settings
    public KeyedObjectPool<K, V> createPool() {
    }
    
    

Returns:
the maxIdle setting for pools created by this factory.
Since:
1.5.5
    public int getMaxIdle() {
        return ;
    }

    

Returns:
the maxActive setting for pools created by this factory.
Since:
1.5.5
    public int getMaxActive() {
        return ;
    }

    

Returns:
the maxTotal setting for pools created by this factory.
Since:
1.5.5
    public int getMaxTotal() {
        return ;
    }

    

Returns:
the minIdle setting for pools created by this factory.
Since:
1.5.5
    public int getMinIdle() {
        return ;
    }

    

Returns:
the maxWait setting for pools created by this factory.
Since:
1.5.5
    public long getMaxWait() {
        return ;
    }

    

Returns:
the whenExhaustedAction setting for pools created by this factory.
Since:
1.5.5
    public byte getWhenExhaustedAction() {
        return ;
    }

    

Returns:
the testOnBorrow setting for pools created by this factory.
Since:
1.5.5
    public boolean getTestOnBorrow() {
        return ;
    }

    

Returns:
the testOnReturn setting for pools created by this factory.
Since:
1.5.5
    public boolean getTestOnReturn() {
        return ;
    }

    

Returns:
the testWhileIdle setting for pools created by this factory.
Since:
1.5.5
    public boolean getTestWhileIdle() {
        return ;
    }

    

Returns:
the timeBetweenEvictionRunsMillis setting for pools created by this factory.
Since:
1.5.5
    public long getTimeBetweenEvictionRunsMillis() {
        return ;
    }

    

Returns:
the numTestsPerEvictionRun setting for pools created by this factory.
Since:
1.5.5
    public int getNumTestsPerEvictionRun() {
        return ;
    }

    

Returns:
the minEvictableIdleTimeMillis setting for pools created by this factory.
Since:
1.5.5
    public long getMinEvictableIdleTimeMillis() {
        return ;
    }

    

Returns:
the org.apache.commons.pool.KeyedPoolableObjectFactory used by pools created by this factory.
Since:
1.5.5
    public KeyedPoolableObjectFactory<K, V> getFactory() {
        return ;
    }

    

Returns:
the lifo setting for pools created by this factory.
Since:
1.5.5
    public boolean getLifo() {
        return ;
    }
    //--- protected attributes - deprecated, use getters to access these properties

    
The maxIdle setting for pools created by this factory.

Deprecated:
to be removed in pool 2.0. Use getMaxIdle().
    @Deprecated
    protected int _maxIdle = .;
    
    
The maxActive setting for pools created by this factory.

Deprecated:
to be removed in pool 2.0. Use getMaxActive().
    @Deprecated
    protected int _maxActive = .;
    
    
The maxTotal setting for pools created by this factory.

Deprecated:
to be removed in pool 2.0. Use getMaxTotal().
    @Deprecated
    protected int _maxTotal = .;
    
    
The minIdle setting for pools created by this factory.

Deprecated:
to be removed in pool 2.0. Use getMinIdle().
    @Deprecated
    protected int _minIdle = .;
    
    
The maxWait setting for pools created by this factory.

Deprecated:
to be removed in pool 2.0. Use getMaxWait().
    @Deprecated
    protected long _maxWait = .;
    
    
The whenExhaustedAction setting for pools created by this factory.

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

Deprecated:
to be removed in pool 2.0. Use getTestOnBorrow().
    @Deprecated
    protected boolean _testOnBorrow = .;
    
    
The testOnReturn setting for pools created by this factory.

Deprecated:
to be removed in pool 2.0. Use getTestOnReturn().
    @Deprecated
    protected boolean _testOnReturn = .;
    
    
The testWhileIdle setting for pools created by this factory.

Deprecated:
to be removed in pool 2.0. Use getTestWhileIdle().
    @Deprecated
    protected boolean _testWhileIdle = .;
    
    
The timeBetweenEvictionRunsMillis setting for pools created by this factory.

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

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

Deprecated:
to be removed in pool 2.0. Use getMinEvictableIdleTimeMillis().
    @Deprecated
The org.apache.commons.pool.KeyedPoolableObjectFactory used by pools created by this factory.

Deprecated:
to be removed in pool 2.0. Use getFactory().
    @Deprecated
    protected KeyedPoolableObjectFactory<K, V> _factory = null;
    
    
The lifo setting for pools created by this factory.

Deprecated:
to be removed in pool 2.0. Use getLifo().
    @Deprecated
    protected boolean _lifo = .;
New to GrepCode? Check out our FAQ X