fix:getHost change use to getHostAddress
parent
b7739178c9
commit
4300ca717a
|
@ -23,7 +23,7 @@ public class ConnectionFactory {
|
||||||
sock.connect(socketAddress, ClientGlobal.g_connect_timeout);
|
sock.connect(socketAddress, ClientGlobal.g_connect_timeout);
|
||||||
return new Connection(sock, socketAddress);
|
return new Connection(sock, socketAddress);
|
||||||
} catch (Exception e) {
|
} 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());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,10 +66,10 @@ public class ConnectionManager {
|
||||||
//wait single success
|
//wait single success
|
||||||
continue;
|
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) {
|
} catch (InterruptedException e) {
|
||||||
e.printStackTrace();
|
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;
|
return connection;
|
||||||
|
@ -102,7 +102,7 @@ public class ConnectionManager {
|
||||||
connection.closeDirectly();
|
connection.closeDirectly();
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} 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();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,7 +63,7 @@ public class ConnectionPool {
|
||||||
if (socketAddress == null) {
|
if (socketAddress == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return String.format("%s:%s", socketAddress.getHostName(), socketAddress.getPort());
|
return String.format("%s:%s", socketAddress.getAddress().getHostAddress(), socketAddress.getPort());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue