From c1ee0b0ce8a20ea5096be3acff32446dbf4fc53f Mon Sep 17 00:00:00 2001 From: Nitin Date: Thu, 6 Aug 2015 16:18:52 +0530 Subject: [PATCH 1/2] fix argument to log --- src/main/java/com/zaxxer/hikari/pool/PoolElf.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/zaxxer/hikari/pool/PoolElf.java b/src/main/java/com/zaxxer/hikari/pool/PoolElf.java index 76d72f22..6560a47a 100644 --- a/src/main/java/com/zaxxer/hikari/pool/PoolElf.java +++ b/src/main/java/com/zaxxer/hikari/pool/PoolElf.java @@ -175,7 +175,7 @@ public final class PoolElf void setupConnection(final Connection connection, final long connectionTimeout) throws SQLException { if (isUseJdbc4Validation && !isJdbc4ValidationSupported(connection)) { - throw new SQLException("Connection.isValid() method is not supported, connection test query must be configured"); + throw new SQLException("Connection.isValid() is not supported, configure connection test query."); } networkTimeout = getAndSetNetworkTimeout(connection, connectionTimeout); @@ -269,7 +269,7 @@ public final class PoolElf } if (LOGGER.isDebugEnabled()) { - LOGGER.debug("{} - Reset ({}) on connection {}", resetBits != 0 ? stringFromResetBits(resetBits) : "nothing", poolEntry.connection); + LOGGER.debug("{} - Reset ({}) on connection {}", poolName, resetBits != 0 ? stringFromResetBits(resetBits) : "nothing", poolEntry.connection); } } From 31ddd3d9db5b2a38fb94b3f8c52adaffc95def9e Mon Sep 17 00:00:00 2001 From: Nitin Date: Thu, 6 Aug 2015 17:51:24 +0530 Subject: [PATCH 2/2] smart idleTimeout --- src/main/java/com/zaxxer/hikari/HikariConfig.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/zaxxer/hikari/HikariConfig.java b/src/main/java/com/zaxxer/hikari/HikariConfig.java index ea441326..9c1f230f 100644 --- a/src/main/java/com/zaxxer/hikari/HikariConfig.java +++ b/src/main/java/com/zaxxer/hikari/HikariConfig.java @@ -811,9 +811,13 @@ public class HikariConfig implements HikariConfigMXBean logger.warn("idleTimeout is less than 10000ms, setting to default {}ms.", IDLE_TIMEOUT); idleTimeout = IDLE_TIMEOUT; } - else if (idleTimeout > maxLifetime && maxLifetime > 0) { - logger.warn("idleTimeout is greater than maxLifetime, setting to maxLifetime."); - idleTimeout = maxLifetime; + if (idleTimeout > maxLifetime && maxLifetime > 0) { + logger.warn("idleTimeout is greater than maxLifetime, , disabling it."); + idleTimeout = 0; + } + if (maxLifetime == 0 && idleTimeout == 0) { + logger.warn("setting idleTimeout to {}ms.", IDLE_TIMEOUT); + idleTimeout = IDLE_TIMEOUT; } if (leakDetectionThreshold != 0 && leakDetectionThreshold < TimeUnit.SECONDS.toMillis(2) && !unitTest) {