From 0e3f0eb0f6a808a7e07e88c9bd60d90584f89d7b Mon Sep 17 00:00:00 2001 From: Nitin Date: Fri, 29 Jan 2016 12:06:50 +0530 Subject: [PATCH] leakDetectionThreshold should be less than maxLifetime --- src/main/java/com/zaxxer/hikari/HikariConfig.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/zaxxer/hikari/HikariConfig.java b/src/main/java/com/zaxxer/hikari/HikariConfig.java index 3d24b364..d0f4fcda 100644 --- a/src/main/java/com/zaxxer/hikari/HikariConfig.java +++ b/src/main/java/com/zaxxer/hikari/HikariConfig.java @@ -837,11 +837,6 @@ public class HikariConfig implements HikariConfigMXBean idleTimeout = IDLE_TIMEOUT; } - if (leakDetectionThreshold != 0 && leakDetectionThreshold < TimeUnit.SECONDS.toMillis(2) && !unitTest) { - LOGGER.warn("leakDetectionThreshold is less than 2000ms, setting to minimum 2000ms."); - leakDetectionThreshold = 2000L; - } - if (connectionTimeout != Integer.MAX_VALUE) { if (validationTimeout > connectionTimeout) { LOGGER.warn("validationTimeout should be less than connectionTimeout, setting validationTimeout to connectionTimeout"); @@ -853,6 +848,15 @@ public class HikariConfig implements HikariConfigMXBean } } + if (leakDetectionThreshold != 0 && leakDetectionThreshold < TimeUnit.SECONDS.toMillis(2) && !unitTest) { + LOGGER.warn("leakDetectionThreshold is less than 2000ms, setting to minimum 2000ms."); + leakDetectionThreshold = 2000L; + } + else if (leakDetectionThreshold > maxLifetime && maxLifetime > 2000) { + LOGGER.warn("leakDetectionThreshold is more than maxLifetime, setting to minimum 2000ms."); + leakDetectionThreshold = 2000L; + } + if (maxPoolSize < 0) { if (minIdle < 0) { minIdle = 10;