mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
use ReentrantLock replace sysnchronized. for ali jvm fiber wisp
This commit is contained in:
@@ -231,6 +231,8 @@ public abstract class DruidAbstractDataSource extends WrapperAdapter implements
|
||||
protected Condition notEmpty;
|
||||
protected Condition empty;
|
||||
|
||||
protected ReentrantLock activeConnectionLock = new ReentrantLock();
|
||||
|
||||
protected AtomicLong createCount = new AtomicLong();
|
||||
protected AtomicLong destroyCount = new AtomicLong();
|
||||
|
||||
@@ -1372,8 +1374,11 @@ public abstract class DruidAbstractDataSource extends WrapperAdapter implements
|
||||
}
|
||||
|
||||
public Set<DruidPooledConnection> getActiveConnections() {
|
||||
synchronized (activeConnections) {
|
||||
activeConnectionLock.lock();
|
||||
try {
|
||||
return new HashSet<DruidPooledConnection>(this.activeConnections.keySet());
|
||||
} finally {
|
||||
activeConnectionLock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user