Browse Source

注释一下

release/9.0
abel 6 years ago
parent
commit
9386b8a2bb
  1. 7
      fine-druid/src/com/fr/third/alibaba/druid/pool/DruidDataSource.java

7
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 = new CreateConnectionThread(threadName);
createConnectionThread.setStarted(false); createConnectionThread.setStarted(false);
String destroyName = "Druid-ConnectionPool-Destroy-" + System.identityHashCode(this) + this.getUrl(); String destroyName = "Druid-ConnectionPool-Destroy-" + System.identityHashCode(this) + this.getUrl();
if (destroyConnectionThread != null) {
if (!destroyConnectionThread.isInterrupted()) {
destroyConnectionThread.interrupt();
}
}
destroyConnectionThread = new DestroyConnectionThread(destroyName); destroyConnectionThread = new DestroyConnectionThread(destroyName);
destroyConnectionThread.setStarted(false); destroyConnectionThread.setStarted(false);
initedLatch = new CountDownLatch(2); initedLatch = new CountDownLatch(2);
@ -2220,7 +2225,7 @@ public class DruidDataSource extends DruidAbstractDataSource implements DruidDat
public void run() { public void run() {
while(true) { while(true) {
synchronized (DruidDataSource.this) { synchronized (DruidDataSource.this) {
//生产线程发生了切换,并且有线程在等待连接,需要主动唤醒生产线程,否则由 //生产线程发生了切换,并且有线程在等待连接,需要主动唤醒生产线程,否则由getConnection方法来唤醒生产线程
if (!createConnectionThread.started && !destroyConnectionThread.started && notEmptyWaitThreadCount > 0) { if (!createConnectionThread.started && !destroyConnectionThread.started && notEmptyWaitThreadCount > 0) {
createConnectionThread.setStarted(true); createConnectionThread.setStarted(true);
createConnectionThread.start(); createConnectionThread.start();

Loading…
Cancel
Save