当前位置: 首页>>代码示例>>Java>>正文


Java HikariDataSource.setMinimumIdle方法代码示例

本文整理汇总了Java中com.zaxxer.hikari.HikariDataSource.setMinimumIdle方法的典型用法代码示例。如果您正苦于以下问题:Java HikariDataSource.setMinimumIdle方法的具体用法?Java HikariDataSource.setMinimumIdle怎么用?Java HikariDataSource.setMinimumIdle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.zaxxer.hikari.HikariDataSource的用法示例。


在下文中一共展示了HikariDataSource.setMinimumIdle方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: openConnectionPool

import com.zaxxer.hikari.HikariDataSource; //导入方法依赖的package包/类
private static void openConnectionPool(String url, String driverClass, String username, String password) throws Exception {

        //force the driver to be loaded
        Class.forName(driverClass);

        HikariDataSource pool = new HikariDataSource();
        pool.setJdbcUrl(url);
        pool.setUsername(username);
        pool.setPassword(password);
        pool.setMaximumPoolSize(4);
        pool.setMinimumIdle(1);
        pool.setIdleTimeout(60000);
        pool.setPoolName("Hl7MergeCheckerPool" + url);
        pool.setAutoCommit(false);

        connectionPool = pool;

        //test getting a connection
        Connection conn = pool.getConnection();
        conn.close();
    }
 
开发者ID:endeavourhealth,项目名称:HL7Receiver,代码行数:22,代码来源:Main.java

示例2: initialiseDBConnectionPool

import com.zaxxer.hikari.HikariDataSource; //导入方法依赖的package包/类
private synchronized void initialiseDBConnectionPool() throws ConfigurationException {
    try {
        if (this.dataSource == null) {

            HikariDataSource hikariDataSource = new HikariDataSource();
            hikariDataSource.setJdbcUrl(postgresUrl);
            hikariDataSource.setUsername(postgresUsername);
            hikariDataSource.setPassword(postgresPassword);
            hikariDataSource.setDriverClassName("org.postgresql.Driver");
            hikariDataSource.setMaximumPoolSize(15);
            hikariDataSource.setMinimumIdle(2);
            hikariDataSource.setIdleTimeout(60000);
            hikariDataSource.setConnectionTimeout(5000L);
            hikariDataSource.setPoolName("HL7ReceiverDBConnectionPool");

            this.dataSource = hikariDataSource;
        }
    } catch (Exception e) {
        throw new ConfigurationException("Error creating Hikari connection pool", e);
    }
}
 
开发者ID:endeavourhealth,项目名称:HL7Receiver,代码行数:22,代码来源:Configuration.java

示例3: createHikariDataSource

import com.zaxxer.hikari.HikariDataSource; //导入方法依赖的package包/类
private HikariDataSource createHikariDataSource(JdbcProperties jdbcProperties) {
  HikariDataSource hikariDataSource = new HikariDataSource();
  hikariDataSource.setJdbcUrl(jdbcProperties.getJdbcUrl());
  hikariDataSource.setUsername(jdbcProperties.getUsername());
  hikariDataSource.setPassword(jdbcProperties.getPassword());

  JdbcPoolProperties jdbcPoolProperties = jdbcProperties.getJdbcPool();
  hikariDataSource.setAutoCommit(jdbcPoolProperties.isAutoCommit());
  hikariDataSource.setConnectionTimeout(jdbcPoolProperties.getConnectionTimeout());
  hikariDataSource.setIdleTimeout(jdbcPoolProperties.getIdleTimeout());
  hikariDataSource.setMaxLifetime(jdbcPoolProperties.getMaxLifetime());
  hikariDataSource.setMaximumPoolSize(jdbcPoolProperties.getMaximumPoolSize());
  hikariDataSource.setMinimumIdle(jdbcPoolProperties.getMinimumIdle());
  hikariDataSource
      .setInitializationFailTimeout(jdbcPoolProperties.getInitializationFailTimeout());
  hikariDataSource.setIsolateInternalQueries(jdbcPoolProperties.isIsolateInternalQueries());
  hikariDataSource.setReadOnly(jdbcPoolProperties.isReadOnly());
  hikariDataSource.setRegisterMbeans(jdbcPoolProperties.isRegisterMbeans());
  Optional.ofNullable(jdbcPoolProperties.getDriverClassName())
      .ifPresent(hikariDataSource::setDriverClassName);
  hikariDataSource.setValidationTimeout(jdbcPoolProperties.getValidationTimeout());
  hikariDataSource.setLeakDetectionThreshold(jdbcPoolProperties.getLeakDetectionThreshold());
  return hikariDataSource;
}
 
开发者ID:lord-of-code,项目名称:loc-framework,代码行数:25,代码来源:LocDataSourceAutoConfiguration.java

示例4: primaryDataSource

import com.zaxxer.hikari.HikariDataSource; //导入方法依赖的package包/类
@Bean
public DataSource primaryDataSource() {
    HikariDataSource ds = new HikariDataSource();
    ds.setMaximumPoolSize(100);
    ds.setMinimumIdle(30);
    ds.setDriverClassName("org.h2.Driver");
    ds.setJdbcUrl("jdbc:h2:mem:test");
    ds.setUsername("root");
    ds.setPassword("root");
    return ds;
}
 
开发者ID:SkywalkingTest,项目名称:CNUTCon-2017-Demo,代码行数:12,代码来源:DataSourceConfig.java


注:本文中的com.zaxxer.hikari.HikariDataSource.setMinimumIdle方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。