mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
git-svn-id: http://code.alibabatech.com/svn/druid/trunk@513 b9813039-fb51-4c41-a8b9-e21c2acb5095
This commit is contained in:
@@ -91,8 +91,6 @@ public class DruidDataSource extends DruidAbstractDataSource implements DruidDat
|
||||
private CreateConnectionThread createConnectionThread;
|
||||
private DestroyConnectionThread destoryConnectionThread;
|
||||
|
||||
private boolean removeAbandoned = false;
|
||||
|
||||
private final IdentityHashMap<PoolableConnection, ActiveConnectionTraceInfo> activeConnections = new IdentityHashMap<PoolableConnection, ActiveConnectionTraceInfo>();
|
||||
|
||||
private final CountDownLatch initedLatch = new CountDownLatch(2);
|
||||
@@ -269,8 +267,7 @@ public class DruidDataSource extends DruidAbstractDataSource implements DruidDat
|
||||
LOG.debug("skip not validate connection.");
|
||||
}
|
||||
|
||||
Connection realConnection = poolalbeConnection.getConnection();
|
||||
JdbcUtils.close(realConnection);
|
||||
poolalbeConnection.close(false);
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
@@ -281,11 +278,6 @@ public class DruidDataSource extends DruidAbstractDataSource implements DruidDat
|
||||
}
|
||||
}
|
||||
|
||||
if (removeAbandoned) {
|
||||
StackTraceElement[] stackTrace = Thread.currentThread().getStackTrace();
|
||||
activeConnections.put(poolalbeConnection, new ActiveConnectionTraceInfo(poolalbeConnection, System.currentTimeMillis(), stackTrace));
|
||||
}
|
||||
|
||||
return poolalbeConnection;
|
||||
}
|
||||
}
|
||||
@@ -325,6 +317,11 @@ public class DruidDataSource extends DruidAbstractDataSource implements DruidDat
|
||||
activeCount++;
|
||||
|
||||
poolalbeConnection = new PoolableConnection(holder);
|
||||
|
||||
if (removeAbandoned) {
|
||||
StackTraceElement[] stackTrace = Thread.currentThread().getStackTrace();
|
||||
activeConnections.put(poolalbeConnection, new ActiveConnectionTraceInfo(poolalbeConnection, System.currentTimeMillis(), stackTrace));
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
connectErrorCount++;
|
||||
throw new SQLException(e.getMessage(), e);
|
||||
@@ -347,10 +344,6 @@ public class DruidDataSource extends DruidAbstractDataSource implements DruidDat
|
||||
assert holder != null;
|
||||
|
||||
try {
|
||||
if (removeAbandoned) {
|
||||
activeConnections.remove(pooledConnection);
|
||||
}
|
||||
|
||||
// 第一步,检查连接是否关闭
|
||||
if (conn == null || conn.isClosed()) {
|
||||
lock.lock();
|
||||
|
||||
Reference in New Issue
Block a user