Class BaseObjectPoolConfig<T>
java.lang.Object
org.apache.tomcat.dbcp.pool2.BaseObject
org.apache.tomcat.dbcp.pool2.impl.BaseObjectPoolConfig<T>
- Type Parameters:
T- Type of element pooled.
- All Implemented Interfaces:
Cloneable
- Direct Known Subclasses:
GenericKeyedObjectPoolConfig,GenericObjectPoolConfig
Provides the implementation for the common attributes shared by the
sub-classes. New instances of this class will be created using the defaults
defined by the public constants.
This class is not thread-safe.
- Since:
- 2.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final booleanThe default value for theblockWhenExhaustedconfiguration attribute.static final StringThe default value for theevictionPolicyClassNameconfiguration attribute.static final longThe default value forevictorShutdownTimeoutMillisconfiguration attribute.static final booleanThe default value for thefairnessconfiguration attribute.static final booleanThe default value for enabling JMX for pools created with a configuration instance.static final StringThe default value for the base name to use to name JMX enabled pools created with a configuration instance.static final StringThe default value for the prefix used to name JMX enabled pools created with a configuration instance.static final booleanThe default value for thelifoconfiguration attribute.static final longThe default value for themaxWaitconfiguration attribute.static final longThe default value for theminEvictableIdleTimeMillisconfiguration attribute.static final intThe default value for thenumTestsPerEvictionRunconfiguration attribute.static final longThe default value for thesoftMinEvictableIdleTimeMillisconfiguration attribute.static final booleanThe default value for thetestOnBorrowconfiguration attribute.static final booleanThe default value for thetestOnCreateconfiguration attribute.static final booleanThe default value for thetestOnReturnconfiguration attribute.static final booleanThe default value for thetestWhileIdleconfiguration attribute.static final longThe default value for thetimeBetweenEvictionRunsMillisconfiguration attribute. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanGet the value for theblockWhenExhaustedconfiguration attribute for pools created with this configuration instance.Get the value for theevictionPolicyClassconfiguration attribute for pools created with this configuration instance.Get the value for theevictionPolicyClassNameconfiguration attribute for pools created with this configuration instance.longGet the value for theevictorShutdownTimeoutMillisconfiguration attribute for pools created with this configuration instance.booleanGet the value for thefairnessconfiguration attribute for pools created with this configuration instance.booleanGets the value of the flag that determines if JMX will be enabled for pools created with this configuration instance.Gets the value of the JMX name base that will be used as part of the name assigned to JMX enabled pools created with this configuration instance.Gets the value of the JMX name prefix that will be used as part of the name assigned to JMX enabled pools created with this configuration instance.booleangetLifo()Get the value for thelifoconfiguration attribute for pools created with this configuration instance.longGet the value for themaxWaitconfiguration attribute for pools created with this configuration instance.longGet the value for theminEvictableIdleTimeMillisconfiguration attribute for pools created with this configuration instance.intGet the value for thenumTestsPerEvictionRunconfiguration attribute for pools created with this configuration instance.longGet the value for thesoftMinEvictableIdleTimeMillisconfiguration attribute for pools created with this configuration instance.booleanGet the value for thetestOnBorrowconfiguration attribute for pools created with this configuration instance.booleanGet the value for thetestOnCreateconfiguration attribute for pools created with this configuration instance.booleanGet the value for thetestOnReturnconfiguration attribute for pools created with this configuration instance.booleanGet the value for thetestWhileIdleconfiguration attribute for pools created with this configuration instance.longGet the value for thetimeBetweenEvictionRunsMillisconfiguration attribute for pools created with this configuration instance.voidsetBlockWhenExhausted(boolean blockWhenExhausted) Set the value for theblockWhenExhaustedconfiguration attribute for pools created with this configuration instance.voidsetEvictionPolicy(EvictionPolicy<T> evictionPolicy) Set the value for theevictionPolicyClassconfiguration attribute for pools created with this configuration instance.voidsetEvictionPolicyClassName(String evictionPolicyClassName) Set the value for theevictionPolicyClassNameconfiguration attribute for pools created with this configuration instance.voidsetEvictorShutdownTimeoutMillis(long evictorShutdownTimeoutMillis) Set the value for theevictorShutdownTimeoutMillisconfiguration attribute for pools created with this configuration instance.voidsetFairness(boolean fairness) Set the value for thefairnessconfiguration attribute for pools created with this configuration instance.voidsetJmxEnabled(boolean jmxEnabled) Sets the value of the flag that determines if JMX will be enabled for pools created with this configuration instance.voidsetJmxNameBase(String jmxNameBase) Sets the value of the JMX name base that will be used as part of the name assigned to JMX enabled pools created with this configuration instance.voidsetJmxNamePrefix(String jmxNamePrefix) Sets the value of the JMX name prefix that will be used as part of the name assigned to JMX enabled pools created with this configuration instance.voidsetLifo(boolean lifo) Set the value for thelifoconfiguration attribute for pools created with this configuration instance.voidsetMaxWaitMillis(long maxWaitMillis) Set the value for themaxWaitconfiguration attribute for pools created with this configuration instance.voidsetMinEvictableIdleTimeMillis(long minEvictableIdleTimeMillis) Set the value for theminEvictableIdleTimeMillisconfiguration attribute for pools created with this configuration instance.voidsetNumTestsPerEvictionRun(int numTestsPerEvictionRun) Set the value for thenumTestsPerEvictionRunconfiguration attribute for pools created with this configuration instance.voidsetSoftMinEvictableIdleTimeMillis(long softMinEvictableIdleTimeMillis) Set the value for thesoftMinEvictableIdleTimeMillisconfiguration attribute for pools created with this configuration instance.voidsetTestOnBorrow(boolean testOnBorrow) Set the value for thetestOnBorrowconfiguration attribute for pools created with this configuration instance.voidsetTestOnCreate(boolean testOnCreate) Set the value for thetestOnCreateconfiguration attribute for pools created with this configuration instance.voidsetTestOnReturn(boolean testOnReturn) Set the value for thetestOnReturnconfiguration attribute for pools created with this configuration instance.voidsetTestWhileIdle(boolean testWhileIdle) Set the value for thetestWhileIdleconfiguration attribute for pools created with this configuration instance.voidsetTimeBetweenEvictionRunsMillis(long timeBetweenEvictionRunsMillis) Set the value for thetimeBetweenEvictionRunsMillisconfiguration attribute for pools created with this configuration instance.protected voidtoStringAppendFields(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.BaseObject
toString
-
Field Details
-
DEFAULT_LIFO
public static final boolean DEFAULT_LIFOThe default value for thelifoconfiguration attribute. -
DEFAULT_FAIRNESS
public static final boolean DEFAULT_FAIRNESSThe default value for thefairnessconfiguration attribute. -
DEFAULT_MAX_WAIT_MILLIS
public static final long DEFAULT_MAX_WAIT_MILLISThe default value for themaxWaitconfiguration attribute. -
DEFAULT_MIN_EVICTABLE_IDLE_TIME_MILLIS
public static final long DEFAULT_MIN_EVICTABLE_IDLE_TIME_MILLISThe default value for theminEvictableIdleTimeMillisconfiguration attribute. -
DEFAULT_SOFT_MIN_EVICTABLE_IDLE_TIME_MILLIS
public static final long DEFAULT_SOFT_MIN_EVICTABLE_IDLE_TIME_MILLISThe default value for thesoftMinEvictableIdleTimeMillisconfiguration attribute. -
DEFAULT_EVICTOR_SHUTDOWN_TIMEOUT_MILLIS
public static final long DEFAULT_EVICTOR_SHUTDOWN_TIMEOUT_MILLISThe default value forevictorShutdownTimeoutMillisconfiguration attribute. -
DEFAULT_NUM_TESTS_PER_EVICTION_RUN
public static final int DEFAULT_NUM_TESTS_PER_EVICTION_RUNThe default value for thenumTestsPerEvictionRunconfiguration attribute. -
DEFAULT_TEST_ON_CREATE
public static final boolean DEFAULT_TEST_ON_CREATEThe default value for thetestOnCreateconfiguration attribute. -
DEFAULT_TEST_ON_BORROW
public static final boolean DEFAULT_TEST_ON_BORROWThe default value for thetestOnBorrowconfiguration attribute. -
DEFAULT_TEST_ON_RETURN
public static final boolean DEFAULT_TEST_ON_RETURNThe default value for thetestOnReturnconfiguration attribute. -
DEFAULT_TEST_WHILE_IDLE
public static final boolean DEFAULT_TEST_WHILE_IDLEThe default value for thetestWhileIdleconfiguration attribute. -
DEFAULT_TIME_BETWEEN_EVICTION_RUNS_MILLIS
public static final long DEFAULT_TIME_BETWEEN_EVICTION_RUNS_MILLISThe default value for thetimeBetweenEvictionRunsMillisconfiguration attribute. -
DEFAULT_BLOCK_WHEN_EXHAUSTED
public static final boolean DEFAULT_BLOCK_WHEN_EXHAUSTEDThe default value for theblockWhenExhaustedconfiguration attribute. -
DEFAULT_JMX_ENABLE
public static final boolean DEFAULT_JMX_ENABLEThe default value for enabling JMX for pools created with a configuration instance.- See Also:
-
DEFAULT_JMX_NAME_PREFIX
The default value for the prefix used to name JMX enabled pools created with a configuration instance. -
DEFAULT_JMX_NAME_BASE
The default value for the base name to use to name JMX enabled pools created with a configuration instance. The default isnullwhich means the pool will provide the base name to use. -
DEFAULT_EVICTION_POLICY_CLASS_NAME
The default value for theevictionPolicyClassNameconfiguration attribute.
-
-
Constructor Details
-
BaseObjectPoolConfig
public BaseObjectPoolConfig()
-
-
Method Details
-
getLifo
public boolean getLifo()Get the value for thelifoconfiguration attribute for pools created with this configuration instance.- Returns:
- The current setting of
lifofor this configuration instance - See Also:
-
getFairness
public boolean getFairness()Get the value for thefairnessconfiguration attribute for pools created with this configuration instance.- Returns:
- The current setting of
fairnessfor this configuration instance - See Also:
-
setLifo
public void setLifo(boolean lifo) Set the value for thelifoconfiguration attribute for pools created with this configuration instance.- Parameters:
lifo- The new setting oflifofor this configuration instance- See Also:
-
setFairness
public void setFairness(boolean fairness) Set the value for thefairnessconfiguration attribute for pools created with this configuration instance.- Parameters:
fairness- The new setting offairnessfor this configuration instance- See Also:
-
getMaxWaitMillis
public long getMaxWaitMillis()Get the value for themaxWaitconfiguration attribute for pools created with this configuration instance.- Returns:
- The current setting of
maxWaitfor this configuration instance - See Also:
-
setMaxWaitMillis
public void setMaxWaitMillis(long maxWaitMillis) Set the value for themaxWaitconfiguration attribute for pools created with this configuration instance.- Parameters:
maxWaitMillis- The new setting ofmaxWaitMillisfor this configuration instance- See Also:
-
getMinEvictableIdleTimeMillis
public long getMinEvictableIdleTimeMillis()Get the value for theminEvictableIdleTimeMillisconfiguration attribute for pools created with this configuration instance.- Returns:
- The current setting of
minEvictableIdleTimeMillisfor this configuration instance - See Also:
-
setMinEvictableIdleTimeMillis
public void setMinEvictableIdleTimeMillis(long minEvictableIdleTimeMillis) Set the value for theminEvictableIdleTimeMillisconfiguration attribute for pools created with this configuration instance.- Parameters:
minEvictableIdleTimeMillis- The new setting ofminEvictableIdleTimeMillisfor this configuration instance- See Also:
-
getSoftMinEvictableIdleTimeMillis
public long getSoftMinEvictableIdleTimeMillis()Get the value for thesoftMinEvictableIdleTimeMillisconfiguration attribute for pools created with this configuration instance.- Returns:
- The current setting of
softMinEvictableIdleTimeMillisfor this configuration instance - See Also:
-
setSoftMinEvictableIdleTimeMillis
public void setSoftMinEvictableIdleTimeMillis(long softMinEvictableIdleTimeMillis) Set the value for thesoftMinEvictableIdleTimeMillisconfiguration attribute for pools created with this configuration instance.- Parameters:
softMinEvictableIdleTimeMillis- The new setting ofsoftMinEvictableIdleTimeMillisfor this configuration instance- See Also:
-
getNumTestsPerEvictionRun
public int getNumTestsPerEvictionRun()Get the value for thenumTestsPerEvictionRunconfiguration attribute for pools created with this configuration instance.- Returns:
- The current setting of
numTestsPerEvictionRunfor this configuration instance - See Also:
-
setNumTestsPerEvictionRun
public void setNumTestsPerEvictionRun(int numTestsPerEvictionRun) Set the value for thenumTestsPerEvictionRunconfiguration attribute for pools created with this configuration instance.- Parameters:
numTestsPerEvictionRun- The new setting ofnumTestsPerEvictionRunfor this configuration instance- See Also:
-
getEvictorShutdownTimeoutMillis
public long getEvictorShutdownTimeoutMillis()Get the value for theevictorShutdownTimeoutMillisconfiguration attribute for pools created with this configuration instance.- Returns:
- The current setting of
evictorShutdownTimeoutMillisfor this configuration instance - See Also:
-
setEvictorShutdownTimeoutMillis
public void setEvictorShutdownTimeoutMillis(long evictorShutdownTimeoutMillis) Set the value for theevictorShutdownTimeoutMillisconfiguration attribute for pools created with this configuration instance.- Parameters:
evictorShutdownTimeoutMillis- The new setting ofevictorShutdownTimeoutMillisfor this configuration instance- See Also:
-
getTestOnCreate
public boolean getTestOnCreate()Get the value for thetestOnCreateconfiguration attribute for pools created with this configuration instance.- Returns:
- The current setting of
testOnCreatefor this configuration instance - Since:
- 2.2
- See Also:
-
setTestOnCreate
public void setTestOnCreate(boolean testOnCreate) Set the value for thetestOnCreateconfiguration attribute for pools created with this configuration instance.- Parameters:
testOnCreate- The new setting oftestOnCreatefor this configuration instance- Since:
- 2.2
- See Also:
-
getTestOnBorrow
public boolean getTestOnBorrow()Get the value for thetestOnBorrowconfiguration attribute for pools created with this configuration instance.- Returns:
- The current setting of
testOnBorrowfor this configuration instance - See Also:
-
setTestOnBorrow
public void setTestOnBorrow(boolean testOnBorrow) Set the value for thetestOnBorrowconfiguration attribute for pools created with this configuration instance.- Parameters:
testOnBorrow- The new setting oftestOnBorrowfor this configuration instance- See Also:
-
getTestOnReturn
public boolean getTestOnReturn()Get the value for thetestOnReturnconfiguration attribute for pools created with this configuration instance.- Returns:
- The current setting of
testOnReturnfor this configuration instance - See Also:
-
setTestOnReturn
public void setTestOnReturn(boolean testOnReturn) Set the value for thetestOnReturnconfiguration attribute for pools created with this configuration instance.- Parameters:
testOnReturn- The new setting oftestOnReturnfor this configuration instance- See Also:
-
getTestWhileIdle
public boolean getTestWhileIdle()Get the value for thetestWhileIdleconfiguration attribute for pools created with this configuration instance.- Returns:
- The current setting of
testWhileIdlefor this configuration instance - See Also:
-
setTestWhileIdle
public void setTestWhileIdle(boolean testWhileIdle) Set the value for thetestWhileIdleconfiguration attribute for pools created with this configuration instance.- Parameters:
testWhileIdle- The new setting oftestWhileIdlefor this configuration instance- See Also:
-
getTimeBetweenEvictionRunsMillis
public long getTimeBetweenEvictionRunsMillis()Get the value for thetimeBetweenEvictionRunsMillisconfiguration attribute for pools created with this configuration instance.- Returns:
- The current setting of
timeBetweenEvictionRunsMillisfor this configuration instance - See Also:
-
setTimeBetweenEvictionRunsMillis
public void setTimeBetweenEvictionRunsMillis(long timeBetweenEvictionRunsMillis) Set the value for thetimeBetweenEvictionRunsMillisconfiguration attribute for pools created with this configuration instance.- Parameters:
timeBetweenEvictionRunsMillis- The new setting oftimeBetweenEvictionRunsMillisfor this configuration instance- See Also:
-
getEvictionPolicy
Get the value for theevictionPolicyClassconfiguration attribute for pools created with this configuration instance.- Returns:
- The current setting of
evictionPolicyClassfor this configuration instance - Since:
- 2.6.0
- See Also:
-
getEvictionPolicyClassName
Get the value for theevictionPolicyClassNameconfiguration attribute for pools created with this configuration instance.- Returns:
- The current setting of
evictionPolicyClassNamefor this configuration instance - See Also:
-
setEvictionPolicy
Set the value for theevictionPolicyClassconfiguration attribute for pools created with this configuration instance.- Parameters:
evictionPolicy- The new setting ofevictionPolicyClassfor this configuration instance- Since:
- 2.6.0
- See Also:
-
setEvictionPolicyClassName
Set the value for theevictionPolicyClassNameconfiguration attribute for pools created with this configuration instance.- Parameters:
evictionPolicyClassName- The new setting ofevictionPolicyClassNamefor this configuration instance- See Also:
-
getBlockWhenExhausted
public boolean getBlockWhenExhausted()Get the value for theblockWhenExhaustedconfiguration attribute for pools created with this configuration instance.- Returns:
- The current setting of
blockWhenExhaustedfor this configuration instance - See Also:
-
setBlockWhenExhausted
public void setBlockWhenExhausted(boolean blockWhenExhausted) Set the value for theblockWhenExhaustedconfiguration attribute for pools created with this configuration instance.- Parameters:
blockWhenExhausted- The new setting ofblockWhenExhaustedfor this configuration instance- See Also:
-
getJmxEnabled
public boolean getJmxEnabled()Gets the value of the flag that determines if JMX will be enabled for pools created with this configuration instance.- Returns:
- The current setting of
jmxEnabledfor this configuration instance
-
setJmxEnabled
public void setJmxEnabled(boolean jmxEnabled) Sets the value of the flag that determines if JMX will be enabled for pools created with this configuration instance.- Parameters:
jmxEnabled- The new setting ofjmxEnabledfor this configuration instance
-
getJmxNameBase
Gets the value of the JMX name base that will be used as part of the name assigned to JMX enabled pools created with this configuration instance. A value ofnullmeans that the pool will define the JMX name base.- Returns:
- The current setting of
jmxNameBasefor this configuration instance
-
setJmxNameBase
Sets the value of the JMX name base that will be used as part of the name assigned to JMX enabled pools created with this configuration instance. A value ofnullmeans that the pool will define the JMX name base.- Parameters:
jmxNameBase- The new setting ofjmxNameBasefor this configuration instance
-
getJmxNamePrefix
Gets the value of the JMX name prefix that will be used as part of the name assigned to JMX enabled pools created with this configuration instance.- Returns:
- The current setting of
jmxNamePrefixfor this configuration instance
-
setJmxNamePrefix
Sets the value of the JMX name prefix that will be used as part of the name assigned to JMX enabled pools created with this configuration instance.- Parameters:
jmxNamePrefix- The new setting ofjmxNamePrefixfor this configuration instance
-
toStringAppendFields
Description copied from class:BaseObjectUsed by sub-classes to include the fields defined by the sub-class in theBaseObject.toString()output.- Overrides:
toStringAppendFieldsin classBaseObject- Parameters:
builder- Field names and values are appended to this object
-