GenericKeyedObjectPoolConfig (Apache Tomcat 10.1.48 API Documentation)
Description: declaration: package: org.apache.tomcat.dbcp.pool2.impl, class: GenericKeyedObjectPoolConfig

# 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:
  `Cloneable`

public class GenericKeyedObjectPoolConfig<T> extends BaseObjectPoolConfig<T>
A simple structure encapsulating the configuration for a `GenericKeyedObjectPool`.

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 final int`
  `DEFAULT_MAX_IDLE_PER_KEY`
  The default value for the `maxIdlePerKey` configuration attribute: 8.
  `static final int`
  `DEFAULT_MAX_TOTAL`
  The default value for the `maxTotal` configuration attribute: -1.
  `static final int`
  `DEFAULT_MAX_TOTAL_PER_KEY`
  The default value for the `maxTotalPerKey` configuration attribute: 8.
  `static final int`
  `DEFAULT_MIN_IDLE_PER_KEY`
  The default value for the `minIdlePerKey` configuration attribute: 0.

  ### Fields inherited from class BaseObjectPoolConfig

  `DEFAULT_BLOCK_WHEN_EXHAUSTED, 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

  Modifier and Type
  Method
  Description
  `GenericKeyedObjectPoolConfig<T>`
  `clone()`
  `int`
  `getMaxIdlePerKey()`
  Gets the value for the `maxIdlePerKey` configuration attribute for pools created with this configuration instance.
  `int`
  `getMaxTotal()`
  Gets the value for the `maxTotal` configuration attribute for pools created with this configuration instance.
  `int`
  `getMaxTotalPerKey()`
  Gets the value for the `maxTotalPerKey` configuration attribute for pools created with this configuration instance.
  `int`
  `getMinIdlePerKey()`
  Gets the value for the `minIdlePerKey` configuration attribute for pools created with this configuration instance.
  `void`
  `setMaxIdlePerKey(int maxIdlePerKey)`
  Sets the value for the `maxIdlePerKey` configuration attribute for pools created with this configuration instance.
  `void`
  `setMaxTotal(int maxTotal)`
  Sets the value for the `maxTotal` configuration attribute for pools created with this configuration instance.
  `void`
  `setMaxTotalPerKey(int maxTotalPerKey)`
  Sets the value for the `maxTotalPerKey` configuration attribute for pools created with this configuration instance.
  `void`
  `setMinIdlePerKey(int minIdlePerKey)`
  Sets the value for the `minIdlePerKey` 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 the `BaseObject.toString()` output.

  ### Methods inherited from class BaseObjectPoolConfig

  `getBlockWhenExhausted, 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, 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 BaseObject

  `toString`

  ### Methods inherited from class Object

  `equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- ## Field Details

  - ### DEFAULT_MAX_TOTAL_PER_KEY

    public static final int DEFAULT_MAX_TOTAL_PER_KEY
    The default value for the `maxTotalPerKey` configuration attribute: 8.
    See Also:
      - `GenericKeyedObjectPool.getMaxTotalPerKey()`
      - Constant Field Values

  - ### DEFAULT_MAX_TOTAL

    public static final int DEFAULT_MAX_TOTAL
    The default value for the `maxTotal` configuration attribute: -1.
    See Also:
      - `BaseGenericObjectPool.getMaxTotal()`
      - Constant Field Values

  - ### DEFAULT_MIN_IDLE_PER_KEY

    public static final int DEFAULT_MIN_IDLE_PER_KEY
    The default value for the `minIdlePerKey` configuration attribute: 0.
    See Also:
      - `GenericKeyedObjectPool.getMinIdlePerKey()`
      - Constant Field Values

  - ### DEFAULT_MAX_IDLE_PER_KEY

    public static final int DEFAULT_MAX_IDLE_PER_KEY
    The default value for the `maxIdlePerKey` configuration attribute: 8.
    See Also:
      - `GenericKeyedObjectPool.getMaxIdlePerKey()`
      - Constant Field Values

- ## Constructor Details

  - ### GenericKeyedObjectPoolConfig

    public GenericKeyedObjectPoolConfig()
    Constructs a new configuration with default settings.

- ## Method Details

  - ### clone

    public GenericKeyedObjectPoolConfig<T> clone()
    Overrides:
      `clone` in class `Object`

  - ### getMaxIdlePerKey

    public int getMaxIdlePerKey()
    Gets the value for the `maxIdlePerKey` configuration attribute for pools created with this configuration instance.
    Returns:
      The current setting of `maxIdlePerKey` for this configuration instance
    See Also:
      - `GenericKeyedObjectPool.getMaxIdlePerKey()`

  - ### getMaxTotal

    public int getMaxTotal()
    Gets the value for the `maxTotal` configuration attribute for pools created with this configuration instance.
    Returns:
      The current setting of `maxTotal` for this configuration instance
    See Also:
      - `BaseGenericObjectPool.getMaxTotal()`

  - ### getMaxTotalPerKey

    public int getMaxTotalPerKey()
    Gets the value for the `maxTotalPerKey` configuration attribute for pools created with this configuration instance.
    Returns:
      The current setting of `maxTotalPerKey` for this configuration instance
    See Also:
      - `GenericKeyedObjectPool.getMaxTotalPerKey()`

  - ### getMinIdlePerKey

    public int getMinIdlePerKey()
    Gets the value for the `minIdlePerKey` configuration attribute for pools created with this configuration instance.
    Returns:
      The current setting of `minIdlePerKey` for this configuration instance
    See Also:
      - `GenericKeyedObjectPool.getMinIdlePerKey()`

  - ### setMaxIdlePerKey

    public void setMaxIdlePerKey(int maxIdlePerKey)
    Sets the value for the `maxIdlePerKey` configuration attribute for pools created with this configuration instance.
    Parameters:
      `maxIdlePerKey` - The new setting of `maxIdlePerKey` for this configuration instance
    See Also:
      - `GenericKeyedObjectPool.setMaxIdlePerKey(int)`

  - ### setMaxTotal

    public void setMaxTotal(int maxTotal)
    Sets the value for the `maxTotal` configuration attribute for pools created with this configuration instance.
    Parameters:
      `maxTotal` - The new setting of `maxTotal` for this configuration instance
    See Also:
      - `BaseGenericObjectPool.setMaxTotal(int)`

  - ### setMaxTotalPerKey

    public void setMaxTotalPerKey(int maxTotalPerKey)
    Sets the value for the `maxTotalPerKey` configuration attribute for pools created with this configuration instance.
    Parameters:
      `maxTotalPerKey` - The new setting of `maxTotalPerKey` for this configuration instance
    See Also:
      - `GenericKeyedObjectPool.setMaxTotalPerKey(int)`

  - ### setMinIdlePerKey

    public void setMinIdlePerKey(int minIdlePerKey)
    Sets the value for the `minIdlePerKey` configuration attribute for pools created with this configuration instance.
    Parameters:
      `minIdlePerKey` - The new setting of `minIdlePerKey` for this configuration instance
    See Also:
      - `GenericKeyedObjectPool.setMinIdlePerKey(int)`

  - ### toStringAppendFields

    protected void toStringAppendFields(StringBuilder builder)
    Description copied from class: `BaseObject`
    Used by sub-classes to include the fields defined by the sub-class in the `BaseObject.toString()` output.
    Overrides:
      `toStringAppendFields` in class `BaseObjectPoolConfig<T>`
    Parameters:
      `builder` - Field names and values are appended to this object