bug fixed for multi-thread use one connection.

This commit is contained in:
shaojin.wensj
2019-03-20 15:27:33 +08:00
parent ac47967a16
commit 116e7bee1a
3 changed files with 33 additions and 9 deletions
@@ -1679,8 +1679,13 @@ public class DruidDataSource extends DruidAbstractDataSource implements DruidDat
if (requireDiscard) {
if (holder.statementTrace != null) {
for (Statement stmt : holder.statementTrace) {
JdbcUtils.close(stmt);
holder.lock.lock();
try {
for (Statement stmt : holder.statementTrace) {
JdbcUtils.close(stmt);
}
} finally {
holder.lock.unlock();
}
}