Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,7 @@ public class ConnectionPoolConfig {

// Time duration to wait for surrendering an idle connection back to the pool
@NonNull @Builder.Default Duration connectionSurrenderTimeout = Duration.ofMinutes(5);

// Whether to validate connections when borrowing from the pool
@NonNull @Builder.Default Boolean testOnBorrow = true;
}
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,16 @@ private void setPoolProperties(
connectionPool.setMinIdle(getIdleCount(poolConfig.minIdlePercent(), maxConnections));
connectionPool.setBlockWhenExhausted(true);
connectionPool.setMaxWaitMillis(poolConfig.connectionAccessTimeout().toMillis());
connectionPool.setTestOnBorrow(poolConfig.testOnBorrow());
connectionPool.setAbandonedConfig(abandonedConfig);
log.debug(
"Postgres connection pool properties - maxTotal: {}, maxIdle: {}, minIdle: {}, maxWaitMillis: {}, connectionSurrenderTimeout: {}",
"Postgres connection pool properties - maxTotal: {}, maxIdle: {}, minIdle: {}, maxWaitMillis: {}, connectionSurrenderTimeout: {}, testOnBorrow: {}",
connectionPool.getMaxTotal(),
connectionPool.getMaxIdle(),
connectionPool.getMinIdle(),
connectionPool.getMaxWaitMillis(),
poolConfig.connectionSurrenderTimeout());
poolConfig.connectionSurrenderTimeout(),
poolConfig.testOnBorrow());
}

private void setFactoryProperties(
Expand Down
Loading