prevent re-entrancy for closeConnection

This commit is contained in:
YuQing
2025-12-19 11:15:07 +08:00
parent 7825aa0b94
commit ac59ecec49
3 changed files with 12 additions and 2 deletions
+2 -1
View File
@@ -1,7 +1,8 @@
Version 1.39 2025-12-18
Version 1.39 2025-12-19
* ConnectionPool.getKey() use '-' instead of ':'
* ConnectionManager.java: remove private AtomicInteger freeCount
* ConnectionManager.java: prevent re-entrancy for closeConnection
Version 1.38 2025-11-28
* bugfixed: loadStorageServersFromTracker correctly with rw option
@@ -120,6 +120,10 @@ public class Connection {
return false;
}
public boolean isClosed() {
return this.sock == null;
}
public boolean isNeedActiveTest() {
return needActiveTest;
}
@@ -104,6 +104,7 @@ public class ConnectionManager {
if (connection == null) {
return;
}
lock.lock();
try {
connection.setLastAccessTime(System.currentTimeMillis());
@@ -115,8 +116,12 @@ public class ConnectionManager {
}
public void closeConnection(Connection connection) {
if (connection == null) {
return;
}
try {
if (connection != null) {
if (!connection.isClosed()) {
totalCount.decrementAndGet();
connection.closeDirectly();
}