mirror of
https://github.com/alibaba/DataX.git
synced 2025-05-02 07:10:23 +08:00
经测试还有查阅资料 getHostName() 有时候会有获取hostname错误的情况,
用getCanonicalHostName() 可以避免这种情况
This commit is contained in:
parent
643b6e9c64
commit
a571e1c2a7
@ -22,7 +22,8 @@ public class HostUtils {
|
||||
try {
|
||||
InetAddress addr = InetAddress.getLocalHost();
|
||||
ip = addr.getHostAddress();
|
||||
hostname = addr.getHostName();
|
||||
// hostname = addr.getHostName();
|
||||
hostname = addr.getCanonicalHostName();
|
||||
} catch (UnknownHostException e) {
|
||||
log.error("Can't find out address: " + e.getMessage());
|
||||
ip = "UNKNOWN";
|
||||
|
Loading…
Reference in New Issue
Block a user