mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
async close support
This commit is contained in:
@@ -1169,6 +1169,7 @@ public class DruidDataSource extends DruidAbstractDataSource implements DruidDat
|
||||
|
||||
if (requireDiscard) {
|
||||
this.discardConnection(holder.getConnection());
|
||||
holder.setDiscard(true);
|
||||
}
|
||||
|
||||
LOG.error("discard connection", sqlEx);
|
||||
@@ -1225,7 +1226,18 @@ public class DruidDataSource extends DruidAbstractDataSource implements DruidDat
|
||||
}
|
||||
|
||||
// reset holder, restore default settings, clear warnings
|
||||
holder.reset();
|
||||
boolean isSameThread = pooledConnection.getOwnerThread() == Thread.currentThread();
|
||||
if (!isSameThread) {
|
||||
synchronized (pooledConnection) {
|
||||
holder.reset();
|
||||
}
|
||||
} else {
|
||||
holder.reset();
|
||||
}
|
||||
|
||||
if (holder.isDiscard()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (testOnReturn) {
|
||||
boolean validate = testConnectionInternal(physicalConnection);
|
||||
|
||||
Reference in New Issue
Block a user