Java Code Examples for com.zaxxer.hikari.HikariConfig#setDataSource()
The following examples show how to use
com.zaxxer.hikari.HikariConfig#setDataSource() .
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: JooqJobActivityConnectorComponent.java From titus-control-plane with Apache License 2.0 | 6 votes |
@Bean @Primary public JooqContext getJooqContext(JooqConfiguration jooqConfiguration, EmbeddedPostgresService embeddedPostgresService) { HikariConfig hikariConfig = new HikariConfig(); hikariConfig.setAutoCommit(true); // Connection management hikariConfig.setConnectionTimeout(10000); hikariConfig.setMaximumPoolSize(10); hikariConfig.setLeakDetectionThreshold(3000); if (jooqConfiguration.isInMemoryDb()) { hikariConfig.setDataSource(embeddedPostgresService.getDataSource()); } else { hikariConfig.addDataSourceProperty(PGProperty.SSL.getName(), "true"); hikariConfig.addDataSourceProperty(PGProperty.SSL_MODE.getName(), "verify-ca"); hikariConfig.addDataSourceProperty(PGProperty.SSL_FACTORY.getName(), RDSSSLSocketFactory.class.getName()); hikariConfig.setJdbcUrl(jooqConfiguration.getDatabaseUrl()); } return new JooqContext(jooqConfiguration, new HikariDataSource(hikariConfig), embeddedPostgresService); }
Example 2
Source File: JooqJobActivityConnectorComponent.java From titus-control-plane with Apache License 2.0 | 6 votes |
@Bean public JooqContext getJooqProducerContext(JooqConfiguration jooqConfiguration, EmbeddedPostgresService embeddedPostgresService) { HikariConfig hikariConfig = new HikariConfig(); hikariConfig.setAutoCommit(true); // Connection management hikariConfig.setConnectionTimeout(10000); hikariConfig.setMaximumPoolSize(10); hikariConfig.setLeakDetectionThreshold(3000); if (jooqConfiguration.isInMemoryDb()) { hikariConfig.setDataSource(embeddedPostgresService.getDataSource()); } else { hikariConfig.addDataSourceProperty(PGProperty.SSL.getName(), "true"); hikariConfig.addDataSourceProperty(PGProperty.SSL_MODE.getName(), "verify-ca"); hikariConfig.addDataSourceProperty(PGProperty.SSL_FACTORY.getName(), RDSSSLSocketFactory.class.getName()); hikariConfig.setJdbcUrl(jooqConfiguration.getProducerDatatabaseUrl()); } return new JooqContext(jooqConfiguration, new HikariDataSource(hikariConfig), embeddedPostgresService); }
Example 3
Source File: OptimisticLockingRepeatableReadTest.java From high-performance-java-persistence with Apache License 2.0 | 5 votes |
protected HikariDataSource connectionPoolDataSource(DataSource dataSource) { HikariConfig hikariConfig = new HikariConfig(); int cpuCores = Runtime.getRuntime().availableProcessors(); hikariConfig.setMaximumPoolSize(cpuCores * 4); hikariConfig.setDataSource(dataSource); hikariConfig.setTransactionIsolation("TRANSACTION_REPEATABLE_READ"); return new HikariDataSource(hikariConfig); }
Example 4
Source File: ResourceLocalDelayConnectionAcquisitionTest.java From high-performance-java-persistence with Apache License 2.0 | 5 votes |
protected HikariDataSource connectionPoolDataSource(DataSource dataSource) { HikariConfig hikariConfig = new HikariConfig(); int cpuCores = Runtime.getRuntime().availableProcessors(); hikariConfig.setMaximumPoolSize( cpuCores * 4 ); hikariConfig.setDataSource( dataSource ); return new HikariDataSource( hikariConfig ); }