Class PoolConfig


  • public final class PoolConfig
    extends Object
    Configuration for Pool instances.

    Instances of this class are immutable and thread-safe.

    Author:
    Rob Spoor
    • Method Detail

      • maxWaitTime

        public Optional<Duration> maxWaitTime()
        Returns the maximum time to wait when acquiring objects.
        Returns:
        An Optional describing the maximum time to wait when acquiring objects, or Optional#empty() to wait indefinitely.
      • maxIdleTime

        public Optional<Duration> maxIdleTime()
        Returns the maximum time that objects can be idle.
        Returns:
        An Optional describing the maximum time that objects can be idle, or Optional.empty() if objects can be idle indefinitely.
      • initialSize

        public int initialSize()
        Returns the initial pool size. This is the number of idle objects to start with.
        Returns:
        The initial pool size.
      • maxSize

        public int maxSize()
        Returns the maximum pool size. This is the maximum number of objects, both idle and currently in use.
        Returns:
        The maximum pool size.
      • defaultConfig

        public static PoolConfig defaultConfig()
        Returns a default PoolConfig object. This has the same configuration as an object returned by custom().build().
        Returns:
        A default PoolConfig object.
        See Also:
        custom()