|
|
@ -613,6 +613,12 @@ public class DruidDataSource extends DruidAbstractDataSource implements DruidDat |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void checkThread() throws SQLException { |
|
|
|
private void checkThread() throws SQLException { |
|
|
|
|
|
|
|
if (createConnectionThread == null){ |
|
|
|
|
|
|
|
throw new IllegalStateException("createConnectionThread not start!"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (destroyConnectionThread == null){ |
|
|
|
|
|
|
|
throw new IllegalStateException("destroyConnectionThread not start!"); |
|
|
|
|
|
|
|
} |
|
|
|
if (!createConnectionThread.isStarted() && !destroyConnectionThread.isStarted()) { |
|
|
|
if (!createConnectionThread.isStarted() && !destroyConnectionThread.isStarted()) { |
|
|
|
synchronized (this) {//线程安全问题,加个双检锁
|
|
|
|
synchronized (this) {//线程安全问题,加个双检锁
|
|
|
|
if (!createConnectionThread.isStarted() && !destroyConnectionThread.isStarted()) { |
|
|
|
if (!createConnectionThread.isStarted() && !destroyConnectionThread.isStarted()) { |
|
|
@ -2152,8 +2158,8 @@ public class DruidDataSource extends DruidAbstractDataSource implements DruidDat |
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
try { |
|
|
|
Thread.sleep(timeBetweenConnectErrorMillis); |
|
|
|
Thread.sleep(timeBetweenConnectErrorMillis); |
|
|
|
} catch (InterruptedException interruptEx) { |
|
|
|
} catch (InterruptedException ignore) { |
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
DruidDataSource.this.createThreadChange(); |
|
|
|
DruidDataSource.this.createThreadChange(); |
|
|
|
break; |
|
|
|
break; |
|
|
|