assign default keepaliveTime of 2 minutes

pull/2266/head
Brett Wooldridge 2 months ago
parent 1836e3fa6d
commit be6594a7fc
No known key found for this signature in database
GPG Key ID: 4CC08E7F47C3EC76

@ -1,5 +1,11 @@
HikariCP Changes
Changes in 6.2.1
* change default keepaliveTime to 2 minutes
* fix commons-compress dependency, make test scope
Changes in 6.2.0
* merged #2238 handle SQLTimeoutException without eviction. Users looking to preserve previous behavior

@ -209,7 +209,7 @@ pool. The 'ping' is one of either: invocation of the JDBC4 `isValid()` method, o
`connectionTestQuery`. Typically, the duration out-of-the-pool should be measured in single digit milliseconds
or even sub-millisecond, and therefore should have little or no noticeable performance impact. The minimum
allowed value is 30000ms (30 seconds), but a value in the range of minutes is most desirable.
*Default: 0 (disabled)*
*Default: 120000 (2 minutes)*
&#9203;``maxLifetime``<br/>
This property controls the maximum lifetime of a connection in the pool. An in-use connection will

@ -52,7 +52,7 @@ public class HikariConfig implements HikariConfigMXBean
private static final long SOFT_TIMEOUT_FLOOR = Long.getLong("com.zaxxer.hikari.timeoutMs.floor", 250L);
private static final long IDLE_TIMEOUT = MINUTES.toMillis(10);
private static final long MAX_LIFETIME = MINUTES.toMillis(30);
private static final long DEFAULT_KEEPALIVE_TIME = 0L;
private static final long DEFAULT_KEEPALIVE_TIME = MINUTES.toMillis(2);
private static final int DEFAULT_POOL_SIZE = 10;
private static boolean unitTest = false;
@ -1101,13 +1101,13 @@ public class HikariConfig implements HikariConfigMXBean
// keepalive time must larger than 30 seconds
if (keepaliveTime != 0 && keepaliveTime < SECONDS.toMillis(30)) {
LOGGER.warn("{} - keepaliveTime is less than 30000ms, disabling it.", poolName);
keepaliveTime = DEFAULT_KEEPALIVE_TIME;
keepaliveTime = 0L;
}
// keepalive time must be less than maxLifetime (if maxLifetime is enabled)
if (keepaliveTime != 0 && maxLifetime != 0 && keepaliveTime >= maxLifetime) {
LOGGER.warn("{} - keepaliveTime is greater than or equal to maxLifetime, disabling it.", poolName);
keepaliveTime = DEFAULT_KEEPALIVE_TIME;
keepaliveTime = 0L;
}
if (leakDetectionThreshold > 0 && !unitTest) {

Loading…
Cancel
Save