Class SQLPooledDatabaseConfig


  • public class SQLPooledDatabaseConfig
    extends SQLDatabaseConfig
    Allows configuring SQL DB pool options.
    Since:
    0.1
    Author:
    nedis
    See Also:
    Duration
    • Field Detail

      • DEFAULT_ACQUIRE_RETRY

        public static final int DEFAULT_ACQUIRE_RETRY
        Default acquire retry.
        See Also:
        Constant Field Values
      • DEFAULT_INIT_POOL_SIZE

        public static final int DEFAULT_INIT_POOL_SIZE
        Default init pool size.
        See Also:
        Constant Field Values
      • DEFAULT_MAX_POOL_SIZE

        public static final int DEFAULT_MAX_POOL_SIZE
        Default max pool size.
        See Also:
        Constant Field Values
      • DEFAULT_MAX_IDLE_TIME_IN_SECONDS

        public static final int DEFAULT_MAX_IDLE_TIME_IN_SECONDS
        Default max idle time in seconds.
        See Also:
        Constant Field Values
    • Constructor Detail

      • SQLPooledDatabaseConfig

        public SQLPooledDatabaseConfig()
    • Method Detail

      • getAcquireRetry

        public int getAcquireRetry()
        Returns the number of retries if the first connection acquire attempt fails.

        Defaults to 2

        Returns:
        the number of retries if the first connection acquire attempt fails.
      • setAcquireRetry

        @BuilderMethod
        public SQLPooledDatabaseConfig setAcquireRetry​(int acquireRetry)
        Sets the number of retries if the first connection acquire attempt fails.

        Defaults to 2

        Parameters:
        acquireRetry - the number of retries if the first connection acquire attempt fails.
        Returns:
        the reference to this SQLPooledDatabaseConfig instance
      • getInitialSize

        public int getInitialSize()
        Returns the initial pool size.

        Defaults to 3

        Returns:
        the initial pool size
      • getMaxSize

        public int getMaxSize()
        Returns the maximum pool size.

        Defaults to 5

        Returns:
        the maximum pool size
      • getValidationQuery

        public String getValidationQuery()
        Returns the query that will be executed just before a connection is given to you from the pool to validate that the connection to the database is still alive.
        Returns:
        the query that will be executed just before a connection is given to you from the pool to validate that the connection to the database is still alive.
      • setValidationQuery

        @BuilderMethod
        public SQLPooledDatabaseConfig setValidationQuery​(String validationQuery)
        Sets the query that will be executed just before a connection is given to you from the pool to validate that the connection to the database is still alive.
        Parameters:
        validationQuery - the query that will be executed just before a connection is given to you from the pool to validate that the connection to the database is still alive.
        Returns:
        the reference to this SQLPooledDatabaseConfig instance
      • getMaxIdleTime

        public Duration getMaxIdleTime()
        Returns the maximum idle time of the connection in the pool.
        Returns:
        the maximum idle time of the connection in the pool.
      • getMaxCreateConnectionTime

        public Duration getMaxCreateConnectionTime()
        Returns the maximum time to create a new connection.
        Returns:
        the maximum time to create a new connection.
      • getMaxAcquireTime

        public Duration getMaxAcquireTime()
        Returns the maximum time to acquire connection from pool.
        Returns:
        the maximum time to acquire connection from pool.
      • getMaxLifeTime

        public Duration getMaxLifeTime()
        Returns the maximum lifetime of the connection in the pool.
        Returns:
        the maximum lifetime of the connection in the pool.