Java Code Examples for com.zaxxer.hikari.HikariDataSource#setInitializationFailTimeout()
The following examples show how to use
com.zaxxer.hikari.HikariDataSource#setInitializationFailTimeout() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LocDataSourceAutoConfiguration.java From loc-framework with MIT License | 6 votes |
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; }
Example 2
Source File: DynamicTenantAwareRoutingSource.java From SpringBootMultiTenancy with MIT License | 5 votes |
private HikariDataSource buildDataSource(DatabaseConfiguration configuration) { HikariDataSource dataSource = new HikariDataSource(); dataSource.setInitializationFailTimeout(0); dataSource.setMaximumPoolSize(5); dataSource.setDataSourceClassName(configuration.getDataSourceClassName()); dataSource.addDataSourceProperty("url", configuration.getUrl()); dataSource.addDataSourceProperty("user", configuration.getUser()); dataSource.addDataSourceProperty("password", configuration.getPassword()); return dataSource; }
Example 3
Source File: SampleSpringApplication.java From SpringBootMultiTenancy with MIT License | 5 votes |
public DataSource tenantOne() { HikariDataSource dataSource = new HikariDataSource(); dataSource.setInitializationFailTimeout(0); dataSource.setMaximumPoolSize(5); dataSource.setDataSourceClassName("org.postgresql.ds.PGSimpleDataSource"); dataSource.addDataSourceProperty("url", "jdbc:postgresql://127.0.0.1:5432/sampledb"); dataSource.addDataSourceProperty("user", "philipp"); dataSource.addDataSourceProperty("password", "test_pwd"); return dataSource; }
Example 4
Source File: SampleSpringApplication.java From SpringBootMultiTenancy with MIT License | 5 votes |
public DataSource tenantTwo() { HikariDataSource dataSource = new HikariDataSource(); dataSource.setInitializationFailTimeout(0); dataSource.setMaximumPoolSize(5); dataSource.setDataSourceClassName("org.postgresql.ds.PGSimpleDataSource"); dataSource.addDataSourceProperty("url", "jdbc:postgresql://127.0.0.1:5432/sampledb2"); dataSource.addDataSourceProperty("user", "philipp"); dataSource.addDataSourceProperty("password", "test_pwd"); return dataSource; }