in tx-control-providers/jpa/tx-control-provider-jpa-common/src/main/java/org/apache/aries/tx/control/jpa/common/impl/JPADataSourceHelper.java [43:70]
public static DataSource poolIfNecessary(Map<String, Object> resourceProviderProperties, DataSource unpooled) {
DataSource toUse;
if (toBoolean(resourceProviderProperties, CONNECTION_POOLING_ENABLED, true)) {
HikariConfig hcfg = new HikariConfig();
hcfg.setDataSource(unpooled);
// Sizes
hcfg.setMaximumPoolSize(toInt(resourceProviderProperties, MAX_CONNECTIONS, 10));
hcfg.setMinimumIdle(toInt(resourceProviderProperties, MIN_CONNECTIONS, 10));
// Timeouts
hcfg.setConnectionTimeout(toLong(resourceProviderProperties, CONNECTION_TIMEOUT, SECONDS.toMillis(30)));
hcfg.setIdleTimeout(toLong(resourceProviderProperties, IDLE_TIMEOUT, TimeUnit.MINUTES.toMillis(3)));
hcfg.setMaxLifetime(toLong(resourceProviderProperties, CONNECTION_LIFETIME, HOURS.toMillis(3)));
ofNullable(resourceProviderProperties)
.map(m -> m.get(CONNECTION_TEST_QUERY))
.map(String::valueOf)
.ifPresent(q -> hcfg.setConnectionTestQuery(q));
toUse = new HikariDataSource(hcfg);
} else {
toUse = unpooled;
}
return toUse;
}