From 9386b8a2bb8d2939bcc3d4561f4f50b1cc51530e Mon Sep 17 00:00:00 2001 From: abel Date: Wed, 29 Aug 2018 16:41:20 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B3=A8=E9=87=8A=E4=B8=80=E4=B8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/third/alibaba/druid/pool/DruidDataSource.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/fine-druid/src/com/fr/third/alibaba/druid/pool/DruidDataSource.java b/fine-druid/src/com/fr/third/alibaba/druid/pool/DruidDataSource.java index a9f783bfe..ef1481c9d 100644 --- a/fine-druid/src/com/fr/third/alibaba/druid/pool/DruidDataSource.java +++ b/fine-druid/src/com/fr/third/alibaba/druid/pool/DruidDataSource.java @@ -608,6 +608,11 @@ public class DruidDataSource extends DruidAbstractDataSource implements DruidDat createConnectionThread = new CreateConnectionThread(threadName); createConnectionThread.setStarted(false); String destroyName = "Druid-ConnectionPool-Destroy-" + System.identityHashCode(this) + this.getUrl(); + if (destroyConnectionThread != null) { + if (!destroyConnectionThread.isInterrupted()) { + destroyConnectionThread.interrupt(); + } + } destroyConnectionThread = new DestroyConnectionThread(destroyName); destroyConnectionThread.setStarted(false); initedLatch = new CountDownLatch(2); @@ -2220,7 +2225,7 @@ public class DruidDataSource extends DruidAbstractDataSource implements DruidDat public void run() { while(true) { synchronized (DruidDataSource.this) { - //生产线程发生了切换,并且有线程在等待连接,需要主动唤醒生产线程,否则由 + //生产线程发生了切换,并且有线程在等待连接,需要主动唤醒生产线程,否则由getConnection方法来唤醒生产线程 if (!createConnectionThread.started && !destroyConnectionThread.started && notEmptyWaitThreadCount > 0) { createConnectionThread.setStarted(true); createConnectionThread.start();