From da4ffe6d18bf34e447ab2b232f21e60258338e2d Mon Sep 17 00:00:00 2001 From: Brett Wooldridge Date: Fri, 21 Nov 2014 23:11:31 +0900 Subject: [PATCH] Fix a fast-spin loop when the pool is suspended and and connections are attempted to be added. --- .../src/main/java/com/zaxxer/hikari/pool/HikariPool.java | 2 +- hikaricp/src/main/java/com/zaxxer/hikari/pool/HikariPool.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/hikaricp-java6/src/main/java/com/zaxxer/hikari/pool/HikariPool.java b/hikaricp-java6/src/main/java/com/zaxxer/hikari/pool/HikariPool.java index 0d08d5f9..fd166fe4 100644 --- a/hikaricp-java6/src/main/java/com/zaxxer/hikari/pool/HikariPool.java +++ b/hikaricp-java6/src/main/java/com/zaxxer/hikari/pool/HikariPool.java @@ -432,7 +432,7 @@ public final class HikariPool implements HikariPoolMBean, IBagStateListener // Speculative increment of totalConnections with expectation of success if (totalConnections.incrementAndGet() > configuration.getMaximumPoolSize() || isShutdown || isPoolSuspended) { totalConnections.decrementAndGet(); - return true; + return !isPoolSuspended; } Connection connection = null; diff --git a/hikaricp/src/main/java/com/zaxxer/hikari/pool/HikariPool.java b/hikaricp/src/main/java/com/zaxxer/hikari/pool/HikariPool.java index 78bfef0f..2a945e47 100644 --- a/hikaricp/src/main/java/com/zaxxer/hikari/pool/HikariPool.java +++ b/hikaricp/src/main/java/com/zaxxer/hikari/pool/HikariPool.java @@ -412,7 +412,7 @@ public final class HikariPool implements HikariPoolMBean, IBagStateListener // Speculative increment of totalConnections with expectation of success if (totalConnections.incrementAndGet() > configuration.getMaximumPoolSize() || isShutdown || isPoolSuspended) { totalConnections.decrementAndGet(); - return true; + return !isPoolSuspended; } Connection connection = null;