diff options
author | Håkon Hallingstad <hakon@yahoo-inc.com> | 2016-10-13 14:39:55 +0200 |
---|---|---|
committer | Håkon Hallingstad <hakon@yahoo-inc.com> | 2016-10-13 14:44:16 +0200 |
commit | 351e31fe39e6dec924abec367691c158fe471345 (patch) | |
tree | f7b4bb7a60f77db83b5deadbb922993b02c93f37 /messagebus | |
parent | 4781e77d144f932913d0e37924ed931bbd880e13 (diff) |
Fall back to picking another resolvable and reachable address if the system
hostname isn't.
Diffstat (limited to 'messagebus')
-rw-r--r-- | messagebus/src/main/java/com/yahoo/messagebus/network/Identity.java | 11 |
1 files changed, 1 insertions, 10 deletions
diff --git a/messagebus/src/main/java/com/yahoo/messagebus/network/Identity.java b/messagebus/src/main/java/com/yahoo/messagebus/network/Identity.java index 45887b072ab..585fe680ba9 100644 --- a/messagebus/src/main/java/com/yahoo/messagebus/network/Identity.java +++ b/messagebus/src/main/java/com/yahoo/messagebus/network/Identity.java @@ -1,12 +1,7 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.messagebus.network; -import com.yahoo.log.LogLevel; import com.yahoo.net.HostName; -import com.yahoo.net.LinuxInetAddress; - -import java.net.Inet6Address; -import java.net.InetAddress; /** * This class encapsulates the identity of the application that uses this instance of message bus. This identity @@ -28,11 +23,7 @@ public class Identity { * @param configId The config identifier for the application. */ public Identity(String configId) { - InetAddress addr = LinuxInetAddress.getLocalHost(); // try hard to get a resolvable address - if (addr instanceof Inet6Address) // - hostname = HostName.getLocalhost(); // ... but fallback to hostname if we get an IPv6 address - else - hostname = addr.getCanonicalHostName(); + hostname = HostName.getLocalhost(); // ... but fallback to hostname if we get an IPv6 address servicePrefix = configId; } |