ConnectionPool.getKey() use '-' instead of ':'

This commit is contained in:
YuQing
2025-12-18 10:39:33 +08:00
parent 91a5cc2e36
commit d29ca63106
6 changed files with 8 additions and 5 deletions
@@ -97,6 +97,7 @@ public class Connection {
}
return isConnected;
}
public boolean isAvaliable() {
if (isConnected()) {
if (sock.getPort() == 0) {
@@ -23,7 +23,8 @@ public class ConnectionFactory {
sock.connect(socketAddress, ClientGlobal.g_connect_timeout);
return new Connection(sock, socketAddress);
} catch (Exception e) {
throw new MyException("connect to server " + socketAddress.getAddress().getHostAddress() + ":" + socketAddress.getPort() + " fail, emsg: " + e.getMessage());
throw new MyException("connect to server " + socketAddress.getAddress().getHostAddress()
+ ":" + socketAddress.getPort() + " fail, emsg: " + e.getMessage());
}
}
}
@@ -115,7 +115,6 @@ public class ConnectionManager {
} finally {
lock.unlock();
}
}
public void closeConnection(Connection connection) {
@@ -43,7 +43,6 @@ public class ConnectionPool {
} else {
connection.closeDirectly();
}
}
public static void closeConnection(Connection connection) throws IOException {
@@ -64,7 +63,7 @@ public class ConnectionPool {
if (socketAddress == null) {
return null;
}
return String.format("%s:%s", socketAddress.getAddress().getHostAddress(), socketAddress.getPort());
return String.format("%s-%s", socketAddress.getAddress().getHostAddress(), socketAddress.getPort());
}
@Override