From 9a2c2413c06ff7483f80f6629efd25db6ea2dd1f Mon Sep 17 00:00:00 2001 From: wenshao Date: Fri, 5 Dec 2014 23:27:36 +0800 Subject: [PATCH] bug fixed for async closed --- .../com/alibaba/druid/pool/DruidPooledConnection.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/main/java/com/alibaba/druid/pool/DruidPooledConnection.java b/src/main/java/com/alibaba/druid/pool/DruidPooledConnection.java index c4b831014a..90677c7eb7 100644 --- a/src/main/java/com/alibaba/druid/pool/DruidPooledConnection.java +++ b/src/main/java/com/alibaba/druid/pool/DruidPooledConnection.java @@ -1085,6 +1085,17 @@ public class DruidPooledConnection extends PoolableWrapper implements javax.sql. } public void checkState() throws SQLException { + boolean asyncCloseEnable = this.getConnectionHolder().getDataSource().isAsyncCloseConnectionEnable(); + if (asyncCloseEnable) { + synchronized (this) { + checkStateInternal(); + } + } else { + checkStateInternal(); + } + } + + private void checkStateInternal() throws SQLException { if (holder == null) { if (disableError != null) { throw new SQLException("connection holder is null", disableError);