mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
recycle add physicalConnection closed check.
This commit is contained in:
@@ -1660,6 +1660,17 @@ public class DruidDataSource extends DruidAbstractDataSource implements DruidDat
|
||||
return;
|
||||
}
|
||||
|
||||
if (physicalConnection.isClosed()) {
|
||||
lock.lock();
|
||||
try {
|
||||
activeCount--;
|
||||
closeCount++;
|
||||
} finally {
|
||||
lock.unlock();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (testOnReturn) {
|
||||
boolean validate = testConnectionInternal(holder, physicalConnection);
|
||||
if (!validate) {
|
||||
@@ -1686,14 +1697,6 @@ public class DruidDataSource extends DruidAbstractDataSource implements DruidDat
|
||||
boolean result;
|
||||
final long lastActiveTimeMillis = System.currentTimeMillis();
|
||||
lock.lock();
|
||||
// ====== begin =======
|
||||
// lockInterruptibly的实现有如下问题:
|
||||
// 会导致当前线程被Interrupt时,holder无法正常被回收
|
||||
// 因此改成 lock.lock();
|
||||
// comment by wubiliang(未立)
|
||||
// 原来的代码是
|
||||
// lock.lockInterruptibly();
|
||||
// ====== end =======
|
||||
try {
|
||||
activeCount--;
|
||||
closeCount++;
|
||||
|
||||
Reference in New Issue
Block a user