diff --git a/src/main/java/org/csource/fastdfs/pool/ConnectionFactory.java b/src/main/java/org/csource/fastdfs/pool/ConnectionFactory.java index 3d026ed..a7d0738 100644 --- a/src/main/java/org/csource/fastdfs/pool/ConnectionFactory.java +++ b/src/main/java/org/csource/fastdfs/pool/ConnectionFactory.java @@ -23,7 +23,7 @@ public class ConnectionFactory { sock.connect(socketAddress, ClientGlobal.g_connect_timeout); return new Connection(sock, socketAddress); } catch (Exception e) { - throw new MyException("get connection error, ip:host = " + socketAddress.getHostName() + ":" + socketAddress.getPort() + ", emsg:" + e.getMessage()); + throw new MyException("connect to server, " + socketAddress.getAddress().getHostAddress() + ":" + socketAddress.getPort() + " fail, emsg:" + e.getMessage()); } } } diff --git a/src/main/java/org/csource/fastdfs/pool/ConnectionManager.java b/src/main/java/org/csource/fastdfs/pool/ConnectionManager.java index 0b1b251..cd9ccae 100644 --- a/src/main/java/org/csource/fastdfs/pool/ConnectionManager.java +++ b/src/main/java/org/csource/fastdfs/pool/ConnectionManager.java @@ -66,10 +66,10 @@ public class ConnectionManager { //wait single success continue; } - throw new MyException("get connection fail,ip:port = " + inetSocketAddress.getHostName() + ":" + inetSocketAddress.getPort() + " ,wait_time > " + ClientGlobal.g_connection_pool_max_wait_time_in_ms + "ms"); + throw new MyException("connect to server " + inetSocketAddress.getHostName() + ":" + inetSocketAddress.getPort() + " fail, wait_time > " + ClientGlobal.g_connection_pool_max_wait_time_in_ms + "ms"); } catch (InterruptedException e) { e.printStackTrace(); - throw new MyException("get connection fail, ip:port = " + inetSocketAddress.getHostName() + ":" + inetSocketAddress.getPort() + ", emsg:" + e.getMessage()); + throw new MyException("connect to server " + inetSocketAddress.getHostName() + ":" + inetSocketAddress.getPort() + " fail, emsg:" + e.getMessage()); } } return connection; @@ -102,7 +102,7 @@ public class ConnectionManager { connection.closeDirectly(); } } catch (IOException e) { - System.err.println("close socket error,ip:port = " + inetSocketAddress.getHostName() + ":" + inetSocketAddress.getPort() + ",emsg:" + e.getMessage()); + System.err.println("close socket[" + inetSocketAddress.getAddress().getHostAddress() + ":" + inetSocketAddress.getPort() + "] error ,emsg:" + e.getMessage()); e.printStackTrace(); } } diff --git a/src/main/java/org/csource/fastdfs/pool/ConnectionPool.java b/src/main/java/org/csource/fastdfs/pool/ConnectionPool.java index b643adf..f5ac1ec 100644 --- a/src/main/java/org/csource/fastdfs/pool/ConnectionPool.java +++ b/src/main/java/org/csource/fastdfs/pool/ConnectionPool.java @@ -63,7 +63,7 @@ public class ConnectionPool { if (socketAddress == null) { return null; } - return String.format("%s:%s", socketAddress.getHostName(), socketAddress.getPort()); + return String.format("%s:%s", socketAddress.getAddress().getHostAddress(), socketAddress.getPort()); } @Override