recover fatal error

This commit is contained in:
高铁
2019-08-20 19:52:54 +08:00
parent 0666546a2f
commit 6b9b189d41
2 changed files with 16 additions and 9 deletions
@@ -1740,6 +1740,8 @@ public class DruidDataSource extends DruidAbstractDataSource implements DruidDat
sql = sql.substring(0, 1024);
}
DruidAbstractDataSource dataSource = holder.getDataSource();
boolean requireDiscard = false;
final ReentrantLock lock = conn.lock;
lock.lock();
@@ -1755,18 +1757,23 @@ public class DruidDataSource extends DruidAbstractDataSource implements DruidDat
fatalErrorCount++;
lastFatalError = error;
lastFatalErrorSql = sql;
ReentrantLock dataSourceLock = holder.getDataSource().lock;
dataSourceLock.lock();
try {
emptySignal();
} finally {
dataSourceLock.unlock();
}
} finally {
lock.unlock();
}
if(dataSource != null) {
ReentrantLock dataSourceLock = dataSource.lock;
dataSourceLock.lock();
try {
if (poolingCount < minIdle) {
emptySignal();
}
}
finally {
dataSourceLock.unlock();
}
}
if (requireDiscard) {
if (holder.statementTrace != null) {
holder.lock.lock();