From 88b57c3bd7cd3d40c229f178344f6b1fc6c8629e Mon Sep 17 00:00:00 2001 From: Brett Wooldridge Date: Sun, 20 May 2018 13:38:24 +0900 Subject: [PATCH] Check closed condition before attempting to set network timeout. --- src/main/java/com/zaxxer/hikari/pool/PoolBase.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/zaxxer/hikari/pool/PoolBase.java b/src/main/java/com/zaxxer/hikari/pool/PoolBase.java index 7f0689b9..1ffff702 100644 --- a/src/main/java/com/zaxxer/hikari/pool/PoolBase.java +++ b/src/main/java/com/zaxxer/hikari/pool/PoolBase.java @@ -128,9 +128,10 @@ abstract class PoolBase try { LOGGER.debug("{} - Closing connection {}: {}", poolName, connection, closureReason); try { - setNetworkTimeout(connection, SECONDS.toMillis(15)); - } - finally { + if (!connection.isClosed()) { + setNetworkTimeout(connection, SECONDS.toMillis(15)); + } + } finally { connection.close(); // continue with the close even if setNetworkTimeout() throws } }