aboutsummaryrefslogtreecommitdiffstats
path: root/vespajlib
diff options
context:
space:
mode:
Diffstat (limited to 'vespajlib')
-rw-r--r--vespajlib/src/main/java/com/yahoo/net/HostName.java6
-rw-r--r--vespajlib/src/main/java/com/yahoo/net/LinuxInetAddress.java11
2 files changed, 5 insertions, 12 deletions
diff --git a/vespajlib/src/main/java/com/yahoo/net/HostName.java b/vespajlib/src/main/java/com/yahoo/net/HostName.java
index 9dff33e1f5f..4e791ca117a 100644
--- a/vespajlib/src/main/java/com/yahoo/net/HostName.java
+++ b/vespajlib/src/main/java/com/yahoo/net/HostName.java
@@ -15,12 +15,11 @@ public class HostName {
private static String myHost = null;
/**
- * Static method that returns the name of localhost using shell
- * command "hostname".
+ * Static method that returns the name of localhost using shell command "hostname".
+ * If you need a guaranteed resolvable name see LinuxINetAddress.
*
* @return the name of localhost.
* @throws RuntimeException if executing the command 'hostname' fails.
- * @see LinuxInetAddress if you need a host name/address which is reachable
*/
public static synchronized String getLocalhost() {
if (myHost == null) {
@@ -38,4 +37,5 @@ public class HostName {
}
return myHost;
}
+
}
diff --git a/vespajlib/src/main/java/com/yahoo/net/LinuxInetAddress.java b/vespajlib/src/main/java/com/yahoo/net/LinuxInetAddress.java
index 1b7658b3a11..9d50c99d77c 100644
--- a/vespajlib/src/main/java/com/yahoo/net/LinuxInetAddress.java
+++ b/vespajlib/src/main/java/com/yahoo/net/LinuxInetAddress.java
@@ -12,28 +12,23 @@ import java.util.stream.Collectors;
/**
* Utilities for returning localhost addresses on Linux.
- * See
- * http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4665037
- * on why this is necessary.
+ * See http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4665037 on why this is necessary.
*
* @author bratseth
*/
-// TODO: Remove on vespa 7
public class LinuxInetAddress {
/**
- * Returns an InetAddress representing the address of the localhost.
+ * Returns an InetAddress representing a resolvable localhost address.
* A non-loopback address is preferred if available.
* An address that resolves to a hostname is preferred among non-loopback addresses.
* IPv4 is preferred over IPv6 among resolving addresses.
*
* @return a localhost address
- * @deprecated use {@link HostName} instead
*/
// Note: Checking resolvability of ipV6 addresses takes a long time on some systems (over 5 seconds
// for some addresses on my mac). This method is written to minimize the number of resolution checks done
// and to defer ip6 checks until necessary.
- @Deprecated
public static InetAddress getLocalHost() {
InetAddress fallback = InetAddress.getLoopbackAddress();
try {
@@ -70,9 +65,7 @@ public class LinuxInetAddress {
*
* @return an array of the addresses of this
* @throws UnknownHostException if we cannot access the network
- * @deprecated do not use
*/
- @Deprecated
public static InetAddress[] getAllLocal() throws UnknownHostException {
InetAddress[] localInetAddresses = InetAddress.getAllByName("127.0.0.1");
if ( ! localInetAddresses[0].isLoopbackAddress()) return localInetAddresses;