Class HikariDataSourceConfig.BuilderBase<BUILDER extends HikariDataSourceConfig.BuilderBase<BUILDER,PROTOTYPE>,PROTOTYPE extends HikariDataSourceConfig>

java.lang.Object
io.helidon.data.sql.common.ConnectionConfig.BuilderBase<BUILDER,PROTOTYPE>
io.helidon.data.sql.datasource.hikari.HikariDataSourceConfig.BuilderBase<BUILDER,PROTOTYPE>
Type Parameters:
BUILDER - type of the builder extending this abstract builder
PROTOTYPE - type of the prototype interface that would be built by Prototype.Builder.buildPrototype()
All Implemented Interfaces:
Prototype.Builder<BUILDER,PROTOTYPE>, ConfigBuilderSupport.ConfiguredBuilder<BUILDER,PROTOTYPE>, ConfigBuilderSupport.ConfiguredBuilder<BUILDER,PROTOTYPE>
Direct Known Subclasses:
HikariDataSourceConfig.Builder
Enclosing interface:
HikariDataSourceConfig

public abstract static class HikariDataSourceConfig.BuilderBase<BUILDER extends HikariDataSourceConfig.BuilderBase<BUILDER,PROTOTYPE>,PROTOTYPE extends HikariDataSourceConfig> extends ConnectionConfig.BuilderBase<BUILDER,PROTOTYPE> implements ConfigBuilderSupport.ConfiguredBuilder<BUILDER,PROTOTYPE>
Fluent API builder base for HikariDataSourceConfig.
  • Constructor Details

    • BuilderBase

      protected BuilderBase()
      Protected to support extensibility.
  • Method Details

    • from

      public BUILDER from(HikariDataSourceConfig prototype)
      Update this builder from an existing prototype instance. This method disables automatic service discovery.
      Parameters:
      prototype - existing prototype to update this builder from
      Returns:
      updated builder instance
    • from

      public BUILDER from(HikariDataSourceConfig.BuilderBase<?,?> builder)
      Update this builder from an existing prototype builder instance.
      Parameters:
      builder - existing builder prototype to update this builder from
      Returns:
      updated builder instance
    • config

      @Deprecated public BUILDER config(Config config)
      Update builder from configuration (node of this type). If a value is present in configuration, it would override currently configured values.
      Specified by:
      config in interface ConfigBuilderSupport.ConfiguredBuilder<BUILDER extends HikariDataSourceConfig.BuilderBase<BUILDER,PROTOTYPE>,PROTOTYPE extends HikariDataSourceConfig>
      Overrides:
      config in class ConnectionConfig.BuilderBase<BUILDER extends HikariDataSourceConfig.BuilderBase<BUILDER,PROTOTYPE>,PROTOTYPE extends HikariDataSourceConfig>
      Parameters:
      config - configuration instance used to obtain values to update this builder
      Returns:
      updated builder instance
    • config

      public BUILDER config(Config config)
      Update builder from configuration (node of this type). If a value is present in configuration, it would override currently configured values.
      Specified by:
      config in interface ConfigBuilderSupport.ConfiguredBuilder<BUILDER extends HikariDataSourceConfig.BuilderBase<BUILDER,PROTOTYPE>,PROTOTYPE extends HikariDataSourceConfig>
      Overrides:
      config in class ConnectionConfig.BuilderBase<BUILDER extends HikariDataSourceConfig.BuilderBase<BUILDER,PROTOTYPE>,PROTOTYPE extends HikariDataSourceConfig>
      Parameters:
      config - configuration instance used to obtain values to update this builder
      Returns:
      updated builder instance
    • name

      public BUILDER name(String name)
      Name of this provider.
      Parameters:
      name - the provider name
      Returns:
      updated builder instance
      See Also:
    • clearAllowPoolSuspension

      public BUILDER clearAllowPoolSuspension()
      Clear existing value of this property.
      Returns:
      updated builder instance
      See Also:
    • allowPoolSuspension

      public BUILDER allowPoolSuspension(boolean allowPoolSuspension)
      Set whether pool suspension is allowed. See HikariConfig.setAllowPoolSuspension(boolean) for details.
      Parameters:
      allowPoolSuspension - the desired pool suspension allowance
      Returns:
      updated builder instance
      See Also:
    • clearAutoCommit

      public BUILDER clearAutoCommit()
      Clear existing value of this property.
      Returns:
      updated builder instance
      See Also:
    • autoCommit

      public BUILDER autoCommit(boolean autoCommit)
      Set the default auto-commit behavior of connections in the pool. See HikariConfig.setAutoCommit(boolean) for details.
      Parameters:
      autoCommit - the desired auto-commit default for connections
      Returns:
      updated builder instance
      See Also:
    • clearCatalog

      public BUILDER clearCatalog()
      Clear existing value of this property.
      Returns:
      updated builder instance
      See Also:
    • catalog

      public BUILDER catalog(String catalog)
      Set the default catalog name to be set on connections. See HikariConfig.setCatalog(String) for details.
      Parameters:
      catalog - the default catalog name
      Returns:
      updated builder instance
      See Also:
    • clearConnectionInitSql

      public BUILDER clearConnectionInitSql()
      Clear existing value of this property.
      Returns:
      updated builder instance
      See Also:
    • connectionInitSql

      public BUILDER connectionInitSql(String connectionInitSql)
      Set the SQL string that will be executed on all new connections when they are created, before they are added to the pool. See HikariConfig.setConnectionInitSql(String) for details.
      Parameters:
      connectionInitSql - the SQL to execute on new connections
      Returns:
      updated builder instance
      See Also:
    • clearConnectionTestQuery

      public BUILDER clearConnectionTestQuery()
      Clear existing value of this property.
      Returns:
      updated builder instance
      See Also:
    • connectionTestQuery

      public BUILDER connectionTestQuery(String connectionTestQuery)
      Set the SQL query to be executed to test the validity of connections. See HikariConfig.setConnectionTestQuery(String) for details.
      Parameters:
      connectionTestQuery - a SQL query string
      Returns:
      updated builder instance
      See Also:
    • clearConnectionTimeout

      public BUILDER clearConnectionTimeout()
      Clear existing value of this property.
      Returns:
      updated builder instance
      See Also:
    • connectionTimeout

      public BUILDER connectionTimeout(long connectionTimeout)
      Set the maximum number of milliseconds that a client will wait for a connection from the pool. See HikariConfig.setConnectionTimeout(long) for details.
      Parameters:
      connectionTimeout - the connection timeout in milliseconds
      Returns:
      updated builder instance
      See Also:
    • healthCheckProperties

      public BUILDER healthCheckProperties(Map<String,String> healthCheckProperties)
      Add properties (name/value pair) that will be used to configure the connection pool health check. See HikariConfig.addHealthCheckProperty(String, String) for details. This method replaces all values with the new ones.
      Parameters:
      healthCheckProperties - the health check properties
      Returns:
      updated builder instance
      See Also:
    • addHealthCheckProperties

      public BUILDER addHealthCheckProperties(Map<String,String> healthCheckProperties)
      Add properties (name/value pair) that will be used to configure the connection pool health check. See HikariConfig.addHealthCheckProperty(String, String) for details. This method keeps existing values, then puts all new values into the map.
      Parameters:
      healthCheckProperties - the health check properties
      Returns:
      updated builder instance
      See Also:
    • putHealthCheckProperty

      public BUILDER putHealthCheckProperty(String key, String healthCheckProperty)
      Add properties (name/value pair) that will be used to configure the connection pool health check. See HikariConfig.addHealthCheckProperty(String, String) for details. This method adds a new value to the map, or replaces it if the key already exists.
      Parameters:
      key - key to add or replace
      healthCheckProperty - new value for the key
      Returns:
      updated builder instance
      See Also:
    • clearIdleTimeout

      public BUILDER clearIdleTimeout()
      Clear existing value of this property.
      Returns:
      updated builder instance
      See Also:
    • idleTimeout

      public BUILDER idleTimeout(long idleTimeout)
      This property controls the maximum amount of time that a connection is allowed to sit idle in the pool. See HikariConfig.setIdleTimeout(long) for details.
      Parameters:
      idleTimeout - the idle timeout in milliseconds
      Returns:
      updated builder instance
      See Also:
    • clearInitializationFailTimeout

      public BUILDER clearInitializationFailTimeout()
      Clear existing value of this property.
      Returns:
      updated builder instance
      See Also:
    • initializationFailTimeout

      public BUILDER initializationFailTimeout(long initializationFailTimeout)
      Set the pool initialization failure timeout. See HikariConfig.setInitializationFailTimeout(long) for details.
      Parameters:
      initializationFailTimeout - the number of milliseconds before the pool initialization fails, or 0 to validate connection setup but continue with pool start, or less than zero to skip all initialization checks and start the pool without delay
      Returns:
      updated builder instance
      See Also:
    • clearIsolateInternalQueries

      public BUILDER clearIsolateInternalQueries()
      Clear existing value of this property.
      Returns:
      updated builder instance
      See Also:
    • isolateInternalQueries

      public BUILDER isolateInternalQueries(boolean isolateInternalQueries)
      Configure whether internal pool queries, principally aliveness checks, will be isolated in their own transaction via Connection.rollback(). See HikariConfig.setIsolateInternalQueries(boolean) for details.
      Parameters:
      isolateInternalQueries - true if internal pool queries should be isolated, false if not
      Returns:
      updated builder instance
      See Also:
    • clearKeepaliveTime

      public BUILDER clearKeepaliveTime()
      Clear existing value of this property.
      Returns:
      updated builder instance
      See Also:
    • keepaliveTime

      public BUILDER keepaliveTime(long keepaliveTime)
      This property controls the keepalive interval for a connection in the pool. See HikariConfig.setKeepaliveTime(long) for details.
      Parameters:
      keepaliveTime - the interval in which connections will be tested for aliveness, thus keeping them alive by the act of checking. Value is in milliseconds.
      Returns:
      updated builder instance
      See Also:
    • clearLeakDetectionThreshold

      public BUILDER clearLeakDetectionThreshold()
      Clear existing value of this property.
      Returns:
      updated builder instance
      See Also:
    • leakDetectionThreshold

      public BUILDER leakDetectionThreshold(long leakDetectionThreshold)
      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. See HikariConfig.setLeakDetectionThreshold(long) for details.
      Parameters:
      leakDetectionThreshold - the connection leak detection threshold in milliseconds
      Returns:
      updated builder instance
      See Also:
    • clearMaximumPoolSize

      public BUILDER clearMaximumPoolSize()
      Clear existing value of this property.
      Returns:
      updated builder instance
      See Also:
    • maximumPoolSize

      public BUILDER maximumPoolSize(int maximumPoolSize)
      The property controls the maximum size that the pool is allowed to reach, including both idle and in-use connections. See HikariConfig.setMaximumPoolSize(int) for details.
      Parameters:
      maximumPoolSize - the maximum number of connections in the pool
      Returns:
      updated builder instance
      See Also:
    • clearMaxLifetime

      public BUILDER clearMaxLifetime()
      Clear existing value of this property.
      Returns:
      updated builder instance
      See Also:
    • maxLifetime

      public BUILDER maxLifetime(long maxLifetime)
      This property controls the maximum lifetime of a connection in the pool. See HikariConfig.setMaxLifetime(long) for details.
      Parameters:
      maxLifetime - the maximum connection lifetime in milliseconds
      Returns:
      updated builder instance
      See Also:
    • clearMinimumIdle

      public BUILDER clearMinimumIdle()
      Clear existing value of this property.
      Returns:
      updated builder instance
      See Also:
    • minimumIdle

      public BUILDER minimumIdle(int minimumIdle)
      The property controls the minimum number of idle connections that HikariCP tries to maintain in the pool, including both idle and in-use connections. See HikariConfig.setMinimumIdle(int) for details.
      Parameters:
      minimumIdle - the minimum number of idle connections in the pool to maintain
      Returns:
      updated builder instance
      See Also:
    • clearPoolName

      public BUILDER clearPoolName()
      Clear existing value of this property.
      Returns:
      updated builder instance
      See Also:
    • poolName

      public BUILDER poolName(String poolName)
      Set the name of the connection pool. See HikariConfig.setPoolName(String) for details.
      Parameters:
      poolName - the name of the connection pool
      Returns:
      updated builder instance
      See Also:
    • clearReadOnly

      public BUILDER clearReadOnly()
      Clear existing value of this property.
      Returns:
      updated builder instance
      See Also:
    • readOnly

      public BUILDER readOnly(boolean readOnly)
      Configures the Connections to be added to the pool as read-only Connections. See HikariConfig.setReadOnly(boolean) for details.
      Parameters:
      readOnly - true if the Connections in the pool are read-only, false if not
      Returns:
      updated builder instance
      See Also:
    • clearRegisterMbeans

      public BUILDER clearRegisterMbeans()
      Clear existing value of this property.
      Returns:
      updated builder instance
      See Also:
    • registerMbeans

      public BUILDER registerMbeans(boolean registerMbeans)
      Configures whether HikariCP self-registers the HikariConfigMXBean and HikariPoolMXBean in JMX. See HikariConfig.setRegisterMbeans(boolean) for details.
      Parameters:
      registerMbeans - true if HikariCP should register MXBeans, false if it should not
      Returns:
      updated builder instance
      See Also:
    • clearSchema

      public BUILDER clearSchema()
      Clear existing value of this property.
      Returns:
      updated builder instance
      See Also:
    • schema

      public BUILDER schema(String schema)
      Set the default schema name to be set on connections. See HikariConfig.setSchema(String) for details.
      Parameters:
      schema - the name of the default schema
      Returns:
      updated builder instance
      See Also:
    • clearTransactionIsolation

      public BUILDER clearTransactionIsolation()
      Clear existing value of this property.
      Returns:
      updated builder instance
      See Also:
    • transactionIsolation

      public BUILDER transactionIsolation(TransactionIsolation transactionIsolation)
      Set the default transaction isolation level. See HikariConfig.setTransactionIsolation(String) for details.
      Parameters:
      transactionIsolation - the isolation level
      Returns:
      updated builder instance
      See Also:
    • clearValidationTimeout

      public BUILDER clearValidationTimeout()
      Clear existing value of this property.
      Returns:
      updated builder instance
      See Also:
    • validationTimeout

      public BUILDER validationTimeout(long validationTimeout)
      Sets the maximum number of milliseconds that the pool will wait for a connection to be validated as alive. See HikariConfig.setValidationTimeout(long) for details.
      Parameters:
      validationTimeout - the validation timeout in milliseconds
      Returns:
      updated builder instance
      See Also:
    • properties

      public BUILDER properties(Map<String,String> properties)
      Add properties (name/value pair) that will be used to configure the DataSource/Driver. Property values are limited to String values. See HikariConfig.addDataSourceProperty(String, Object) for details. This method replaces all values with the new ones.
      Parameters:
      properties - the properties
      Returns:
      updated builder instance
      See Also:
    • addProperties

      public BUILDER addProperties(Map<String,String> properties)
      Add properties (name/value pair) that will be used to configure the DataSource/Driver. Property values are limited to String values. See HikariConfig.addDataSourceProperty(String, Object) for details. This method keeps existing values, then puts all new values into the map.
      Parameters:
      properties - the properties
      Returns:
      updated builder instance
      See Also:
    • putProperty

      public BUILDER putProperty(String key, String property)
      Add properties (name/value pair) that will be used to configure the DataSource/Driver. Property values are limited to String values. See HikariConfig.addDataSourceProperty(String, Object) for details. This method adds a new value to the map, or replaces it if the key already exists.
      Parameters:
      key - key to add or replace
      property - new value for the key
      Returns:
      updated builder instance
      See Also:
    • name

      public Optional<String> name()
      Name of this provider.
      Returns:
      the name
    • allowPoolSuspension

      public Optional<Boolean> allowPoolSuspension()
      Set whether pool suspension is allowed. See HikariConfig.setAllowPoolSuspension(boolean) for details.
      Returns:
      the allow pool suspension
    • autoCommit

      public Optional<Boolean> autoCommit()
      Set the default auto-commit behavior of connections in the pool. See HikariConfig.setAutoCommit(boolean) for details.
      Returns:
      the auto commit
    • catalog

      public Optional<String> catalog()
      Set the default catalog name to be set on connections. See HikariConfig.setCatalog(String) for details.
      Returns:
      the catalog
    • connectionInitSql

      public Optional<String> connectionInitSql()
      Set the SQL string that will be executed on all new connections when they are created, before they are added to the pool. See HikariConfig.setConnectionInitSql(String) for details.
      Returns:
      the connection init sql
    • connectionTestQuery

      public Optional<String> connectionTestQuery()
      Set the SQL query to be executed to test the validity of connections. See HikariConfig.setConnectionTestQuery(String) for details.
      Returns:
      the connection test query
    • connectionTimeout

      public Optional<Long> connectionTimeout()
      Set the maximum number of milliseconds that a client will wait for a connection from the pool. See HikariConfig.setConnectionTimeout(long) for details.
      Returns:
      the connection timeout
    • healthCheckProperties

      public Map<String,String> healthCheckProperties()
      Add properties (name/value pair) that will be used to configure the connection pool health check. See HikariConfig.addHealthCheckProperty(String, String) for details.
      Returns:
      the health check properties
    • idleTimeout

      public Optional<Long> idleTimeout()
      This property controls the maximum amount of time that a connection is allowed to sit idle in the pool. See HikariConfig.setIdleTimeout(long) for details.
      Returns:
      the idle timeout
    • initializationFailTimeout

      public Optional<Long> initializationFailTimeout()
      Set the pool initialization failure timeout. See HikariConfig.setInitializationFailTimeout(long) for details.
      Returns:
      the initialization fail timeout
    • isolateInternalQueries

      public Optional<Boolean> isolateInternalQueries()
      Configure whether internal pool queries, principally aliveness checks, will be isolated in their own transaction via Connection.rollback(). See HikariConfig.setIsolateInternalQueries(boolean) for details.
      Returns:
      the isolate internal queries
    • keepaliveTime

      public Optional<Long> keepaliveTime()
      This property controls the keepalive interval for a connection in the pool. See HikariConfig.setKeepaliveTime(long) for details.
      Returns:
      the keepalive time
    • leakDetectionThreshold

      public Optional<Long> leakDetectionThreshold()
      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. See HikariConfig.setLeakDetectionThreshold(long) for details.
      Returns:
      the leak detection threshold
    • maximumPoolSize

      public Optional<Integer> maximumPoolSize()
      The property controls the maximum size that the pool is allowed to reach, including both idle and in-use connections. See HikariConfig.setMaximumPoolSize(int) for details.
      Returns:
      the maximum pool size
    • maxLifetime

      public Optional<Long> maxLifetime()
      This property controls the maximum lifetime of a connection in the pool. See HikariConfig.setMaxLifetime(long) for details.
      Returns:
      the max lifetime
    • minimumIdle

      public Optional<Integer> minimumIdle()
      The property controls the minimum number of idle connections that HikariCP tries to maintain in the pool, including both idle and in-use connections. See HikariConfig.setMinimumIdle(int) for details.
      Returns:
      the minimum idle
    • poolName

      public Optional<String> poolName()
      Set the name of the connection pool. See HikariConfig.setPoolName(String) for details.
      Returns:
      the pool name
    • readOnly

      public Optional<Boolean> readOnly()
      Configures the Connections to be added to the pool as read-only Connections. See HikariConfig.setReadOnly(boolean) for details.
      Returns:
      the read only
    • registerMbeans

      public Optional<Boolean> registerMbeans()
      Configures whether HikariCP self-registers the HikariConfigMXBean and HikariPoolMXBean in JMX. See HikariConfig.setRegisterMbeans(boolean) for details.
      Returns:
      the register mbeans
    • schema

      public Optional<String> schema()
      Set the default schema name to be set on connections. See HikariConfig.setSchema(String) for details.
      Returns:
      the schema
    • transactionIsolation

      public Optional<TransactionIsolation> transactionIsolation()
      Set the default transaction isolation level. See HikariConfig.setTransactionIsolation(String) for details.
      Returns:
      the transaction isolation
    • validationTimeout

      public Optional<Long> validationTimeout()
      Sets the maximum number of milliseconds that the pool will wait for a connection to be validated as alive. See HikariConfig.setValidationTimeout(long) for details.
      Returns:
      the validation timeout
    • properties

      public Map<String,String> properties()
      Add properties (name/value pair) that will be used to configure the DataSource/Driver. Property values are limited to String values. See HikariConfig.addDataSourceProperty(String, Object) for details.
      Returns:
      the properties
    • config

      public Optional<Config> config()
      If this instance was configured, this would be the config instance used.
      Overrides:
      config in class ConnectionConfig.BuilderBase<BUILDER extends HikariDataSourceConfig.BuilderBase<BUILDER,PROTOTYPE>,PROTOTYPE extends HikariDataSourceConfig>
      Returns:
      config node used to configure this builder, or empty if not configured
    • toString

      public String toString()
      Overrides:
      toString in class ConnectionConfig.BuilderBase<BUILDER extends HikariDataSourceConfig.BuilderBase<BUILDER,PROTOTYPE>,PROTOTYPE extends HikariDataSourceConfig>
    • preBuildPrototype

      protected void preBuildPrototype()
      Handles providers and decorators.
      Overrides:
      preBuildPrototype in class ConnectionConfig.BuilderBase<BUILDER extends HikariDataSourceConfig.BuilderBase<BUILDER,PROTOTYPE>,PROTOTYPE extends HikariDataSourceConfig>
    • validatePrototype

      protected void validatePrototype()
      Validates required properties.
      Overrides:
      validatePrototype in class ConnectionConfig.BuilderBase<BUILDER extends HikariDataSourceConfig.BuilderBase<BUILDER,PROTOTYPE>,PROTOTYPE extends HikariDataSourceConfig>