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
Modifier and TypeFieldDescriptionstatic final boolean
The default value for theblockWhenExhausted
configuration attribute.static final String
The default value for theevictionPolicyClassName
configuration attribute.static final long
The default value forevictorShutdownTimeoutMillis
configuration attribute.static final boolean
The default value for thefairness
configuration attribute.static final boolean
The default value for enabling JMX for pools created with a configuration instance.static final String
The default value for the base name to use to name JMX enabled pools created with a configuration instance.static final String
The default value for the prefix used to name JMX enabled pools created with a configuration instance.static final boolean
The default value for thelifo
configuration attribute.static final long
The default value for themaxWait
configuration attribute.static final long
The default value for theminEvictableIdleTimeMillis
configuration attribute.static final int
The default value for thenumTestsPerEvictionRun
configuration attribute.static final long
The default value for thesoftMinEvictableIdleTimeMillis
configuration attribute.static final boolean
The default value for thetestOnBorrow
configuration attribute.static final boolean
The default value for thetestOnCreate
configuration attribute.static final boolean
The default value for thetestOnReturn
configuration attribute.static final boolean
The default value for thetestWhileIdle
configuration attribute.static final long
The default value for thetimeBetweenEvictionRunsMillis
configuration attribute. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Get the value for theblockWhenExhausted
configuration attribute for pools created with this configuration instance.Get the value for theevictionPolicyClass
configuration attribute for pools created with this configuration instance.Get the value for theevictionPolicyClassName
configuration attribute for pools created with this configuration instance.long
Get the value for theevictorShutdownTimeoutMillis
configuration attribute for pools created with this configuration instance.boolean
Get the value for thefairness
configuration attribute for pools created with this configuration instance.boolean
Gets 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.boolean
getLifo()
Get the value for thelifo
configuration attribute for pools created with this configuration instance.long
Get the value for themaxWait
configuration attribute for pools created with this configuration instance.long
Get the value for theminEvictableIdleTimeMillis
configuration attribute for pools created with this configuration instance.int
Get the value for thenumTestsPerEvictionRun
configuration attribute for pools created with this configuration instance.long
Get the value for thesoftMinEvictableIdleTimeMillis
configuration attribute for pools created with this configuration instance.boolean
Get the value for thetestOnBorrow
configuration attribute for pools created with this configuration instance.boolean
Get the value for thetestOnCreate
configuration attribute for pools created with this configuration instance.boolean
Get the value for thetestOnReturn
configuration attribute for pools created with this configuration instance.boolean
Get the value for thetestWhileIdle
configuration attribute for pools created with this configuration instance.long
Get the value for thetimeBetweenEvictionRunsMillis
configuration attribute for pools created with this configuration instance.void
setBlockWhenExhausted
(boolean blockWhenExhausted) Set the value for theblockWhenExhausted
configuration attribute for pools created with this configuration instance.void
setEvictionPolicy
(EvictionPolicy<T> evictionPolicy) Set the value for theevictionPolicyClass
configuration attribute for pools created with this configuration instance.void
setEvictionPolicyClassName
(String evictionPolicyClassName) Set the value for theevictionPolicyClassName
configuration attribute for pools created with this configuration instance.void
setEvictorShutdownTimeoutMillis
(long evictorShutdownTimeoutMillis) Set the value for theevictorShutdownTimeoutMillis
configuration attribute for pools created with this configuration instance.void
setFairness
(boolean fairness) Set the value for thefairness
configuration attribute for pools created with this configuration instance.void
setJmxEnabled
(boolean jmxEnabled) Sets the value of the flag that determines if JMX will be enabled for pools created with this configuration instance.void
setJmxNameBase
(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.void
setJmxNamePrefix
(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.void
setLifo
(boolean lifo) Set the value for thelifo
configuration attribute for pools created with this configuration instance.void
setMaxWaitMillis
(long maxWaitMillis) Set the value for themaxWait
configuration attribute for pools created with this configuration instance.void
setMinEvictableIdleTimeMillis
(long minEvictableIdleTimeMillis) Set the value for theminEvictableIdleTimeMillis
configuration attribute for pools created with this configuration instance.void
setNumTestsPerEvictionRun
(int numTestsPerEvictionRun) Set the value for thenumTestsPerEvictionRun
configuration attribute for pools created with this configuration instance.void
setSoftMinEvictableIdleTimeMillis
(long softMinEvictableIdleTimeMillis) Set the value for thesoftMinEvictableIdleTimeMillis
configuration attribute for pools created with this configuration instance.void
setTestOnBorrow
(boolean testOnBorrow) Set the value for thetestOnBorrow
configuration attribute for pools created with this configuration instance.void
setTestOnCreate
(boolean testOnCreate) Set the value for thetestOnCreate
configuration attribute for pools created with this configuration instance.void
setTestOnReturn
(boolean testOnReturn) Set the value for thetestOnReturn
configuration attribute for pools created with this configuration instance.void
setTestWhileIdle
(boolean testWhileIdle) Set the value for thetestWhileIdle
configuration attribute for pools created with this configuration instance.void
setTimeBetweenEvictionRunsMillis
(long timeBetweenEvictionRunsMillis) Set the value for thetimeBetweenEvictionRunsMillis
configuration attribute for pools created with this configuration instance.protected void
toStringAppendFields
(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 thelifo
configuration attribute. -
DEFAULT_FAIRNESS
public static final boolean DEFAULT_FAIRNESSThe default value for thefairness
configuration attribute. -
DEFAULT_MAX_WAIT_MILLIS
public static final long DEFAULT_MAX_WAIT_MILLISThe default value for themaxWait
configuration attribute. -
DEFAULT_MIN_EVICTABLE_IDLE_TIME_MILLIS
public static final long DEFAULT_MIN_EVICTABLE_IDLE_TIME_MILLISThe default value for theminEvictableIdleTimeMillis
configuration attribute. -
DEFAULT_SOFT_MIN_EVICTABLE_IDLE_TIME_MILLIS
public static final long DEFAULT_SOFT_MIN_EVICTABLE_IDLE_TIME_MILLISThe default value for thesoftMinEvictableIdleTimeMillis
configuration attribute. -
DEFAULT_EVICTOR_SHUTDOWN_TIMEOUT_MILLIS
public static final long DEFAULT_EVICTOR_SHUTDOWN_TIMEOUT_MILLISThe default value forevictorShutdownTimeoutMillis
configuration attribute. -
DEFAULT_NUM_TESTS_PER_EVICTION_RUN
public static final int DEFAULT_NUM_TESTS_PER_EVICTION_RUNThe default value for thenumTestsPerEvictionRun
configuration attribute. -
DEFAULT_TEST_ON_CREATE
public static final boolean DEFAULT_TEST_ON_CREATEThe default value for thetestOnCreate
configuration attribute. -
DEFAULT_TEST_ON_BORROW
public static final boolean DEFAULT_TEST_ON_BORROWThe default value for thetestOnBorrow
configuration attribute. -
DEFAULT_TEST_ON_RETURN
public static final boolean DEFAULT_TEST_ON_RETURNThe default value for thetestOnReturn
configuration attribute. -
DEFAULT_TEST_WHILE_IDLE
public static final boolean DEFAULT_TEST_WHILE_IDLEThe default value for thetestWhileIdle
configuration attribute. -
DEFAULT_TIME_BETWEEN_EVICTION_RUNS_MILLIS
public static final long DEFAULT_TIME_BETWEEN_EVICTION_RUNS_MILLISThe default value for thetimeBetweenEvictionRunsMillis
configuration attribute. -
DEFAULT_BLOCK_WHEN_EXHAUSTED
public static final boolean DEFAULT_BLOCK_WHEN_EXHAUSTEDThe default value for theblockWhenExhausted
configuration 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 isnull
which means the pool will provide the base name to use. -
DEFAULT_EVICTION_POLICY_CLASS_NAME
The default value for theevictionPolicyClassName
configuration attribute.
-
-
Constructor Details
-
BaseObjectPoolConfig
public BaseObjectPoolConfig()
-
-
Method Details
-
getLifo
public boolean getLifo()Get the value for thelifo
configuration attribute for pools created with this configuration instance.- Returns:
- The current setting of
lifo
for this configuration instance - See Also:
-
getFairness
public boolean getFairness()Get the value for thefairness
configuration attribute for pools created with this configuration instance.- Returns:
- The current setting of
fairness
for this configuration instance - See Also:
-
setLifo
public void setLifo(boolean lifo) Set the value for thelifo
configuration attribute for pools created with this configuration instance.- Parameters:
lifo
- The new setting oflifo
for this configuration instance- See Also:
-
setFairness
public void setFairness(boolean fairness) Set the value for thefairness
configuration attribute for pools created with this configuration instance.- Parameters:
fairness
- The new setting offairness
for this configuration instance- See Also:
-
getMaxWaitMillis
public long getMaxWaitMillis()Get the value for themaxWait
configuration attribute for pools created with this configuration instance.- Returns:
- The current setting of
maxWait
for this configuration instance - See Also:
-
setMaxWaitMillis
public void setMaxWaitMillis(long maxWaitMillis) Set the value for themaxWait
configuration attribute for pools created with this configuration instance.- Parameters:
maxWaitMillis
- The new setting ofmaxWaitMillis
for this configuration instance- See Also:
-
getMinEvictableIdleTimeMillis
public long getMinEvictableIdleTimeMillis()Get the value for theminEvictableIdleTimeMillis
configuration attribute for pools created with this configuration instance.- Returns:
- The current setting of
minEvictableIdleTimeMillis
for this configuration instance - See Also:
-
setMinEvictableIdleTimeMillis
public void setMinEvictableIdleTimeMillis(long minEvictableIdleTimeMillis) Set the value for theminEvictableIdleTimeMillis
configuration attribute for pools created with this configuration instance.- Parameters:
minEvictableIdleTimeMillis
- The new setting ofminEvictableIdleTimeMillis
for this configuration instance- See Also:
-
getSoftMinEvictableIdleTimeMillis
public long getSoftMinEvictableIdleTimeMillis()Get the value for thesoftMinEvictableIdleTimeMillis
configuration attribute for pools created with this configuration instance.- Returns:
- The current setting of
softMinEvictableIdleTimeMillis
for this configuration instance - See Also:
-
setSoftMinEvictableIdleTimeMillis
public void setSoftMinEvictableIdleTimeMillis(long softMinEvictableIdleTimeMillis) Set the value for thesoftMinEvictableIdleTimeMillis
configuration attribute for pools created with this configuration instance.- Parameters:
softMinEvictableIdleTimeMillis
- The new setting ofsoftMinEvictableIdleTimeMillis
for this configuration instance- See Also:
-
getNumTestsPerEvictionRun
public int getNumTestsPerEvictionRun()Get the value for thenumTestsPerEvictionRun
configuration attribute for pools created with this configuration instance.- Returns:
- The current setting of
numTestsPerEvictionRun
for this configuration instance - See Also:
-
setNumTestsPerEvictionRun
public void setNumTestsPerEvictionRun(int numTestsPerEvictionRun) Set the value for thenumTestsPerEvictionRun
configuration attribute for pools created with this configuration instance.- Parameters:
numTestsPerEvictionRun
- The new setting ofnumTestsPerEvictionRun
for this configuration instance- See Also:
-
getEvictorShutdownTimeoutMillis
public long getEvictorShutdownTimeoutMillis()Get the value for theevictorShutdownTimeoutMillis
configuration attribute for pools created with this configuration instance.- Returns:
- The current setting of
evictorShutdownTimeoutMillis
for this configuration instance - See Also:
-
setEvictorShutdownTimeoutMillis
public void setEvictorShutdownTimeoutMillis(long evictorShutdownTimeoutMillis) Set the value for theevictorShutdownTimeoutMillis
configuration attribute for pools created with this configuration instance.- Parameters:
evictorShutdownTimeoutMillis
- The new setting ofevictorShutdownTimeoutMillis
for this configuration instance- See Also:
-
getTestOnCreate
public boolean getTestOnCreate()Get the value for thetestOnCreate
configuration attribute for pools created with this configuration instance.- Returns:
- The current setting of
testOnCreate
for this configuration instance - Since:
- 2.2
- See Also:
-
setTestOnCreate
public void setTestOnCreate(boolean testOnCreate) Set the value for thetestOnCreate
configuration attribute for pools created with this configuration instance.- Parameters:
testOnCreate
- The new setting oftestOnCreate
for this configuration instance- Since:
- 2.2
- See Also:
-
getTestOnBorrow
public boolean getTestOnBorrow()Get the value for thetestOnBorrow
configuration attribute for pools created with this configuration instance.- Returns:
- The current setting of
testOnBorrow
for this configuration instance - See Also:
-
setTestOnBorrow
public void setTestOnBorrow(boolean testOnBorrow) Set the value for thetestOnBorrow
configuration attribute for pools created with this configuration instance.- Parameters:
testOnBorrow
- The new setting oftestOnBorrow
for this configuration instance- See Also:
-
getTestOnReturn
public boolean getTestOnReturn()Get the value for thetestOnReturn
configuration attribute for pools created with this configuration instance.- Returns:
- The current setting of
testOnReturn
for this configuration instance - See Also:
-
setTestOnReturn
public void setTestOnReturn(boolean testOnReturn) Set the value for thetestOnReturn
configuration attribute for pools created with this configuration instance.- Parameters:
testOnReturn
- The new setting oftestOnReturn
for this configuration instance- See Also:
-
getTestWhileIdle
public boolean getTestWhileIdle()Get the value for thetestWhileIdle
configuration attribute for pools created with this configuration instance.- Returns:
- The current setting of
testWhileIdle
for this configuration instance - See Also:
-
setTestWhileIdle
public void setTestWhileIdle(boolean testWhileIdle) Set the value for thetestWhileIdle
configuration attribute for pools created with this configuration instance.- Parameters:
testWhileIdle
- The new setting oftestWhileIdle
for this configuration instance- See Also:
-
getTimeBetweenEvictionRunsMillis
public long getTimeBetweenEvictionRunsMillis()Get the value for thetimeBetweenEvictionRunsMillis
configuration attribute for pools created with this configuration instance.- Returns:
- The current setting of
timeBetweenEvictionRunsMillis
for this configuration instance - See Also:
-
setTimeBetweenEvictionRunsMillis
public void setTimeBetweenEvictionRunsMillis(long timeBetweenEvictionRunsMillis) Set the value for thetimeBetweenEvictionRunsMillis
configuration attribute for pools created with this configuration instance.- Parameters:
timeBetweenEvictionRunsMillis
- The new setting oftimeBetweenEvictionRunsMillis
for this configuration instance- See Also:
-
getEvictionPolicy
Get the value for theevictionPolicyClass
configuration attribute for pools created with this configuration instance.- Returns:
- The current setting of
evictionPolicyClass
for this configuration instance - Since:
- 2.6.0
- See Also:
-
getEvictionPolicyClassName
Get the value for theevictionPolicyClassName
configuration attribute for pools created with this configuration instance.- Returns:
- The current setting of
evictionPolicyClassName
for this configuration instance - See Also:
-
setEvictionPolicy
Set the value for theevictionPolicyClass
configuration attribute for pools created with this configuration instance.- Parameters:
evictionPolicy
- The new setting ofevictionPolicyClass
for this configuration instance- Since:
- 2.6.0
- See Also:
-
setEvictionPolicyClassName
Set the value for theevictionPolicyClassName
configuration attribute for pools created with this configuration instance.- Parameters:
evictionPolicyClassName
- The new setting ofevictionPolicyClassName
for this configuration instance- See Also:
-
getBlockWhenExhausted
public boolean getBlockWhenExhausted()Get the value for theblockWhenExhausted
configuration attribute for pools created with this configuration instance.- Returns:
- The current setting of
blockWhenExhausted
for this configuration instance - See Also:
-
setBlockWhenExhausted
public void setBlockWhenExhausted(boolean blockWhenExhausted) Set the value for theblockWhenExhausted
configuration attribute for pools created with this configuration instance.- Parameters:
blockWhenExhausted
- The new setting ofblockWhenExhausted
for 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
jmxEnabled
for 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 ofjmxEnabled
for 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 ofnull
means that the pool will define the JMX name base.- Returns:
- The current setting of
jmxNameBase
for 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 ofnull
means that the pool will define the JMX name base.- Parameters:
jmxNameBase
- The new setting ofjmxNameBase
for 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
jmxNamePrefix
for 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 ofjmxNamePrefix
for this configuration instance
-
toStringAppendFields
Description copied from class:BaseObject
Used by sub-classes to include the fields defined by the sub-class in theBaseObject.toString()
output.- Overrides:
toStringAppendFields
in classBaseObject
- Parameters:
builder
- Field names and values are appended to this object
-