close connection if putLast failed during fill operation

This commit is contained in:
zrlw
2022-08-30 09:00:20 +08:00
committed by 温绍锦
parent c514f6cd5a
commit 51c27ae847
@@ -3823,17 +3823,23 @@ public class DruidDataSource extends DruidAbstractDataSource implements DruidDat
throw new SQLException("interrupt", e);
}
boolean result;
try {
if (!this.isFillable(toCount)) {
JdbcUtils.close(holder.getConnection());
LOG.info("fill connections skip.");
break;
}
this.putLast(holder, System.currentTimeMillis());
result = this.putLast(holder, System.currentTimeMillis());
fillCount++;
} finally {
lock.unlock();
}
if (!result) {
JdbcUtils.close(holder.getConnection());
LOG.info("connection fill failed.");
}
}
if (LOG.isInfoEnabled()) {