Class ConnectionPoolProperties.Builder

java.lang.Object
de.xima.fc.persistence.ConnectionPoolProperties.Builder
Enclosing class:
ConnectionPoolProperties

public static class ConnectionPoolProperties.Builder extends Object
Since:
8.5.0
Author:
Norman Lorenz, Michael Kohlsche
  • Method Details

    • maxConnections

      public ConnectionPoolProperties.Builder maxConnections(int maxConnections)
      The maximum number of connections allowed in the connection pool. If null, the default value from the system connection pool configuration will be used. default: 1
      Returns:
      this.
    • minimumIdleConnections

      public ConnectionPoolProperties.Builder minimumIdleConnections(int minimumIdleConnections)
      The minimum number of idle connections that the connection pool tries to maintain. If the pool has fewer idle connections than this value, it will make an effort to create new idle connections. default: 0
      Returns:
      this.
    • idleTimeoutMs

      public ConnectionPoolProperties.Builder idleTimeoutMs(long idleTimeoutMs)
      The maximum amount of time (in milliseconds) that a connection is allowed to sit idle in the connection pool. When a connection reaches this timeout, it will be retired from the pool. An in-use connection will never be retired, only when it is idle will it be removed. default: 200000 (200 seconds)
      Returns:
      this.
    • connectionTimeoutMs

      public ConnectionPoolProperties.Builder connectionTimeoutMs(long connectionTimeoutMs)
      The maximum amount of time (in milliseconds) that a client will wait for a connection from the pool. If this time is exceeded without a connection becoming available, a SQLException will be thrown from DataSource.getConnection(). default: 30000 (30 seconds)
      Returns:
      this.
    • validationTimeoutMs

      public ConnectionPoolProperties.Builder validationTimeoutMs(long validationTimeoutMs)
      The maximum amount of time (in milliseconds) that a connection will be tested for validity. This is used when a connection is retrieved from the pool or a connection test is performed. If the connection does not respond within this time, it will be considered invalid and will be retired from the pool. default: 5000 (5 seconds)
      Returns:
      this.
    • leakDetectionThresholdMs

      public ConnectionPoolProperties.Builder leakDetectionThresholdMs(long leakDetectionThresholdMs)
      This property controls the amount of time that a connection can be out of the pool before a message is logged indicating a possible connection leak. A value of 0 means leak detection is disabled. default: 0 (disabled)
      Returns:
      this.
    • maxLifetimeMs

      public ConnectionPoolProperties.Builder maxLifetimeMs(long maxLifetimeMs)
      This property controls the maximum lifetime of a connection in the pool. When a connection reaches this timeout, even if recently used, it will be retired from the pool. An in-use connection will never be retired, only when it is idle will it be removed. default: 1800000 (30 minutes)
      Returns:
      this.
    • build

      public ConnectionPoolProperties build()
    • toString

      public String toString()
      Overrides:
      toString in class Object