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();