mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
bug fixed : dup close
This commit is contained in:
@@ -512,6 +512,9 @@ public class DruidDataSource extends DruidAbstractDataSource implements DruidDat
|
||||
|
||||
// exceptionSorter.isExceptionFatal
|
||||
if (exceptionSorter != null && exceptionSorter.isExceptionFatal(sqlEx)) {
|
||||
if (pooledConnection.isTraceEnable()) {
|
||||
activeConnections.remove(pooledConnection);
|
||||
}
|
||||
this.discardConnection(holder.getConnection());
|
||||
pooledConnection.disable();
|
||||
}
|
||||
|
||||
@@ -58,6 +58,7 @@ public class PoolableConnection implements PooledConnection, Connection {
|
||||
protected TransactionInfo transactionInfo;
|
||||
private final boolean dupCloseLogEnable;
|
||||
private boolean traceEnable = false;
|
||||
private boolean diable = false;
|
||||
|
||||
public PoolableConnection(ConnectionHolder holder){
|
||||
this.conn = holder.getConnection();
|
||||
@@ -126,14 +127,24 @@ public class PoolableConnection implements PooledConnection, Connection {
|
||||
}
|
||||
|
||||
void disable() {
|
||||
this.traceEnable = false;
|
||||
this.holder = null;
|
||||
this.transactionInfo = null;
|
||||
this.diable = true;
|
||||
}
|
||||
|
||||
public boolean isDiable() {
|
||||
return diable;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() throws SQLException {
|
||||
ConnectionHolder holder = this.holder;
|
||||
|
||||
if (this.diable) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (holder == null && dupCloseLogEnable) {
|
||||
LOG.error("dup close");
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user