Class GenericKeyedObjectPoolConfig<T>
- java.lang.Object
-
- org.apache.tomcat.dbcp.pool2.BaseObject
-
- org.apache.tomcat.dbcp.pool2.impl.BaseObjectPoolConfig<T>
-
- org.apache.tomcat.dbcp.pool2.impl.GenericKeyedObjectPoolConfig<T>
-
- Type Parameters:
T- Type of element pooled.
- All Implemented Interfaces:
java.lang.Cloneable
public class GenericKeyedObjectPoolConfig<T> extends BaseObjectPoolConfig<T>
A simple structure encapsulating the configuration for aGenericKeyedObjectPool.This class is not thread-safe; it is only intended to be used to provide attributes used when creating a pool.
- Since:
- 2.0
-
-
Field Summary
Fields Modifier and Type Field Description static intDEFAULT_MAX_IDLE_PER_KEYThe default value for themaxIdlePerKeyconfiguration attribute: 8.static intDEFAULT_MAX_TOTALThe default value for themaxTotalconfiguration attribute: -1.static intDEFAULT_MAX_TOTAL_PER_KEYThe default value for themaxTotalPerKeyconfiguration attribute: 8.static intDEFAULT_MIN_IDLE_PER_KEYThe default value for theminIdlePerKeyconfiguration attribute: 0.static booleanDEFAULT_REUSE_CAPACITY_ON_MAINTENANCEThe default value for thereuseCapacityOnMaintenanceconfiguration attribute: false.static booleanDEFAULT_REUSE_CAPACITY_ON_RETURNThe default value for thereuseCapacityOnReturnconfiguration attribute: true.-
Fields inherited from class org.apache.tomcat.dbcp.pool2.impl.BaseObjectPoolConfig
DEFAULT_BLOCK_WHEN_EXHAUSTED, DEFAULT_COLLECT_DETAILED_STATISTICS, DEFAULT_DURATION_BETWEEN_EVICTION_RUNS, DEFAULT_EVICTION_POLICY_CLASS_NAME, DEFAULT_EVICTOR_SHUTDOWN_TIMEOUT, DEFAULT_EVICTOR_SHUTDOWN_TIMEOUT_MILLIS, DEFAULT_FAIRNESS, DEFAULT_JMX_ENABLE, DEFAULT_JMX_NAME_BASE, DEFAULT_JMX_NAME_PREFIX, DEFAULT_LIFO, DEFAULT_MAX_WAIT, DEFAULT_MAX_WAIT_MILLIS, DEFAULT_MIN_EVICTABLE_IDLE_DURATION, DEFAULT_MIN_EVICTABLE_IDLE_TIME, DEFAULT_MIN_EVICTABLE_IDLE_TIME_MILLIS, DEFAULT_NUM_TESTS_PER_EVICTION_RUN, DEFAULT_SOFT_MIN_EVICTABLE_IDLE_DURATION, DEFAULT_SOFT_MIN_EVICTABLE_IDLE_TIME, DEFAULT_SOFT_MIN_EVICTABLE_IDLE_TIME_MILLIS, DEFAULT_TEST_ON_BORROW, DEFAULT_TEST_ON_CREATE, DEFAULT_TEST_ON_RETURN, DEFAULT_TEST_WHILE_IDLE, DEFAULT_TIME_BETWEEN_EVICTION_RUNS, DEFAULT_TIME_BETWEEN_EVICTION_RUNS_MILLIS
-
-
Constructor Summary
Constructors Constructor Description GenericKeyedObjectPoolConfig()Constructs a new configuration with default settings.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description GenericKeyedObjectPoolConfig<T>clone()intgetMaxIdlePerKey()Gets the value for themaxIdlePerKeyconfiguration attribute for pools created with this configuration instance.intgetMaxTotal()Gets the value for themaxTotalconfiguration attribute for pools created with this configuration instance.intgetMaxTotalPerKey()Gets the value for themaxTotalPerKeyconfiguration attribute for pools created with this configuration instance.intgetMinIdlePerKey()Gets the value for theminIdlePerKeyconfiguration attribute for pools created with this configuration instance.booleangetReuseCapacityOnMaintenance()Gets the value for thereuseCapacityOnMaintenanceconfiguration attribute for pools created with this configuration instance.booleangetReuseCapacityOnReturn()Gets the value for thereuseCapacityOnReturnconfiguration attribute for pools created with this configuration instance.voidsetMaxIdlePerKey(int maxIdlePerKey)Sets the value for themaxIdlePerKeyconfiguration attribute for pools created with this configuration instance.voidsetMaxTotal(int maxTotal)Sets the value for themaxTotalconfiguration attribute for pools created with this configuration instance.voidsetMaxTotalPerKey(int maxTotalPerKey)Sets the value for themaxTotalPerKeyconfiguration attribute for pools created with this configuration instance.voidsetMinIdlePerKey(int minIdlePerKey)Sets the value for theminIdlePerKeyconfiguration attribute for pools created with this configuration instance.voidsetReuseCapacityOnMaintenance(boolean reuseCapacityOnMaintenance)Sets the value for thereuseCapacityOnMaintenanceconfiguration attribute for pools created with this configuration instance.voidsetReuseCapacityOnReturn(boolean reuseCapacityOnReturn)Sets the value for thereuseCapacityOnReturnconfiguration attribute for pools created with this configuration instance.protected voidtoStringAppendFields(java.lang.StringBuilder builder)Used by sub-classes to include the fields defined by the sub-class in theBaseObject.toString()output.-
Methods inherited from class org.apache.tomcat.dbcp.pool2.impl.BaseObjectPoolConfig
getBlockWhenExhausted, getCollectDetailedStatistics, getDurationBetweenEvictionRuns, getEvictionPolicy, getEvictionPolicyClassName, getEvictorShutdownTimeout, getEvictorShutdownTimeoutDuration, getEvictorShutdownTimeoutMillis, getFairness, getJmxEnabled, getJmxNameBase, getJmxNamePrefix, getLifo, getMaxWaitDuration, getMaxWaitMillis, getMinEvictableIdleDuration, getMinEvictableIdleTime, getMinEvictableIdleTimeMillis, getNumTestsPerEvictionRun, getSoftMinEvictableIdleDuration, getSoftMinEvictableIdleTime, getSoftMinEvictableIdleTimeMillis, getTestOnBorrow, getTestOnCreate, getTestOnReturn, getTestWhileIdle, getTimeBetweenEvictionRuns, getTimeBetweenEvictionRunsMillis, setBlockWhenExhausted, setCollectDetailedStatistics, setEvictionPolicy, setEvictionPolicyClassName, setEvictorShutdownTimeout, setEvictorShutdownTimeoutMillis, setEvictorShutdownTimeoutMillis, setFairness, setJmxEnabled, setJmxNameBase, setJmxNamePrefix, setLifo, setMaxWait, setMaxWaitMillis, setMinEvictableIdleDuration, setMinEvictableIdleTime, setMinEvictableIdleTimeMillis, setNumTestsPerEvictionRun, setSoftMinEvictableIdleDuration, setSoftMinEvictableIdleTime, setSoftMinEvictableIdleTimeMillis, setTestOnBorrow, setTestOnCreate, setTestOnReturn, setTestWhileIdle, setTimeBetweenEvictionRuns, setTimeBetweenEvictionRunsMillis
-
Methods inherited from class org.apache.tomcat.dbcp.pool2.BaseObject
toString
-
-
-
-
Field Detail
-
DEFAULT_MAX_TOTAL_PER_KEY
public static final int DEFAULT_MAX_TOTAL_PER_KEY
The default value for themaxTotalPerKeyconfiguration attribute: 8.
-
DEFAULT_MAX_TOTAL
public static final int DEFAULT_MAX_TOTAL
The default value for themaxTotalconfiguration attribute: -1.
-
DEFAULT_MIN_IDLE_PER_KEY
public static final int DEFAULT_MIN_IDLE_PER_KEY
The default value for theminIdlePerKeyconfiguration attribute: 0.
-
DEFAULT_MAX_IDLE_PER_KEY
public static final int DEFAULT_MAX_IDLE_PER_KEY
The default value for themaxIdlePerKeyconfiguration attribute: 8.
-
DEFAULT_REUSE_CAPACITY_ON_RETURN
public static final boolean DEFAULT_REUSE_CAPACITY_ON_RETURN
The default value for thereuseCapacityOnReturnconfiguration attribute: true.- Since:
- 2.13.0
- See Also:
GenericKeyedObjectPool.getReuseCapacityOnReturn(), Constant Field Values
-
DEFAULT_REUSE_CAPACITY_ON_MAINTENANCE
public static final boolean DEFAULT_REUSE_CAPACITY_ON_MAINTENANCE
The default value for thereuseCapacityOnMaintenanceconfiguration attribute: false.- Since:
- 2.13.0
- See Also:
GenericKeyedObjectPool.getReuseCapacityOnMaintenance(), Constant Field Values
-
-
Method Detail
-
clone
public GenericKeyedObjectPoolConfig<T> clone()
- Overrides:
clonein classjava.lang.Object
-
getMaxIdlePerKey
public int getMaxIdlePerKey()
Gets the value for themaxIdlePerKeyconfiguration attribute for pools created with this configuration instance.- Returns:
- The current setting of
maxIdlePerKeyfor this configuration instance - See Also:
GenericKeyedObjectPool.getMaxIdlePerKey()
-
getMaxTotal
public int getMaxTotal()
Gets the value for themaxTotalconfiguration attribute for pools created with this configuration instance.- Returns:
- The current setting of
maxTotalfor this configuration instance - See Also:
BaseGenericObjectPool.getMaxTotal()
-
getMaxTotalPerKey
public int getMaxTotalPerKey()
Gets the value for themaxTotalPerKeyconfiguration attribute for pools created with this configuration instance.- Returns:
- The current setting of
maxTotalPerKeyfor this configuration instance - See Also:
GenericKeyedObjectPool.getMaxTotalPerKey()
-
getMinIdlePerKey
public int getMinIdlePerKey()
Gets the value for theminIdlePerKeyconfiguration attribute for pools created with this configuration instance.- Returns:
- The current setting of
minIdlePerKeyfor this configuration instance - See Also:
GenericKeyedObjectPool.getMinIdlePerKey()
-
getReuseCapacityOnMaintenance
public boolean getReuseCapacityOnMaintenance()
Gets the value for thereuseCapacityOnMaintenanceconfiguration attribute for pools created with this configuration instance.- Returns:
- The current setting of
reuseCapacityOnMaintenancefor this configuration instance - Since:
- 2.13.0
- See Also:
GenericKeyedObjectPool.getReuseCapacityOnMaintenance()
-
getReuseCapacityOnReturn
public boolean getReuseCapacityOnReturn()
Gets the value for thereuseCapacityOnReturnconfiguration attribute for pools created with this configuration instance.- Returns:
- The current setting of
reuseCapacityOnReturnfor this configuration instance - Since:
- 2.13.0
- See Also:
GenericKeyedObjectPool.getReuseCapacityOnReturn()
-
setMaxIdlePerKey
public void setMaxIdlePerKey(int maxIdlePerKey)
Sets the value for themaxIdlePerKeyconfiguration attribute for pools created with this configuration instance.- Parameters:
maxIdlePerKey- The new setting ofmaxIdlePerKeyfor this configuration instance- See Also:
GenericKeyedObjectPool.setMaxIdlePerKey(int)
-
setMaxTotal
public void setMaxTotal(int maxTotal)
Sets the value for themaxTotalconfiguration attribute for pools created with this configuration instance.- Parameters:
maxTotal- The new setting ofmaxTotalfor this configuration instance- See Also:
BaseGenericObjectPool.setMaxTotal(int)
-
setMaxTotalPerKey
public void setMaxTotalPerKey(int maxTotalPerKey)
Sets the value for themaxTotalPerKeyconfiguration attribute for pools created with this configuration instance.- Parameters:
maxTotalPerKey- The new setting ofmaxTotalPerKeyfor this configuration instance- See Also:
GenericKeyedObjectPool.setMaxTotalPerKey(int)
-
setMinIdlePerKey
public void setMinIdlePerKey(int minIdlePerKey)
Sets the value for theminIdlePerKeyconfiguration attribute for pools created with this configuration instance.- Parameters:
minIdlePerKey- The new setting ofminIdlePerKeyfor this configuration instance- See Also:
GenericKeyedObjectPool.setMinIdlePerKey(int)
-
setReuseCapacityOnMaintenance
public void setReuseCapacityOnMaintenance(boolean reuseCapacityOnMaintenance)
Sets the value for thereuseCapacityOnMaintenanceconfiguration attribute for pools created with this configuration instance.- Parameters:
reuseCapacityOnMaintenance- The new setting ofreuseCapacityOnMaintenancefor this configuration instance- Since:
- 2.13.0
- See Also:
GenericKeyedObjectPool.setReuseCapacityOnMaintenance(boolean)
-
setReuseCapacityOnReturn
public void setReuseCapacityOnReturn(boolean reuseCapacityOnReturn)
Sets the value for thereuseCapacityOnReturnconfiguration attribute for pools created with this configuration instance.- Parameters:
reuseCapacityOnReturn- The new setting ofreuseCapacityOnReturnfor this configuration instance- Since:
- 2.13.0
- See Also:
GenericKeyedObjectPool.setReuseCapacityOnReturn(boolean)
-
toStringAppendFields
protected void toStringAppendFields(java.lang.StringBuilder builder)
Description copied from class:BaseObjectUsed by sub-classes to include the fields defined by the sub-class in theBaseObject.toString()output.- Overrides:
toStringAppendFieldsin classBaseObjectPoolConfig<T>- Parameters:
builder- Field names and values are appended to this object
-
-