summaryrefslogtreecommitdiffstats
path: root/vespajlib/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'vespajlib/src/main/java')
-rw-r--r--vespajlib/src/main/java/com/yahoo/net/HostName.java6
-rw-r--r--vespajlib/src/main/java/com/yahoo/net/LinuxInetAddress.java11
-rw-r--r--vespajlib/src/main/java/com/yahoo/tensor/serialization/SparseBinaryFormat.java (renamed from vespajlib/src/main/java/com/yahoo/tensor/serialization/CompactBinaryFormat.java)4
-rw-r--r--vespajlib/src/main/java/com/yahoo/tensor/serialization/TypedBinaryFormat.java10
4 files changed, 12 insertions, 19 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;
diff --git a/vespajlib/src/main/java/com/yahoo/tensor/serialization/CompactBinaryFormat.java b/vespajlib/src/main/java/com/yahoo/tensor/serialization/SparseBinaryFormat.java
index e850e20fcab..711e0e834da 100644
--- a/vespajlib/src/main/java/com/yahoo/tensor/serialization/CompactBinaryFormat.java
+++ b/vespajlib/src/main/java/com/yahoo/tensor/serialization/SparseBinaryFormat.java
@@ -12,7 +12,7 @@ import com.yahoo.text.Utf8;
import java.util.*;
/**
- * Implementation of a compact binary format for a tensor on the form:
+ * Implementation of a sparse binary format for a tensor on the form:
*
* Sorted dimensions = num_dimensions [dimension_str_len dimension_str_bytes]*
* Cells = num_cells [label_1_str_len label_1_str_bytes ... label_N_str_len label_N_str_bytes cell_value]*
@@ -23,7 +23,7 @@ import java.util.*;
* @author geirst
*/
@Beta
-class CompactBinaryFormat implements BinaryFormat {
+class SparseBinaryFormat implements BinaryFormat {
@Override
public void encode(GrowableByteBuffer buffer, Tensor tensor) {
diff --git a/vespajlib/src/main/java/com/yahoo/tensor/serialization/TypedBinaryFormat.java b/vespajlib/src/main/java/com/yahoo/tensor/serialization/TypedBinaryFormat.java
index 9e2c0b5a63f..5a45f20b6d8 100644
--- a/vespajlib/src/main/java/com/yahoo/tensor/serialization/TypedBinaryFormat.java
+++ b/vespajlib/src/main/java/com/yahoo/tensor/serialization/TypedBinaryFormat.java
@@ -17,12 +17,12 @@ import com.yahoo.tensor.Tensor;
@Beta
public class TypedBinaryFormat {
- private static final int COMPACT_BINARY_FORMAT_TYPE = 1;
+ private static final int SPARSE_BINARY_FORMAT_TYPE = 1;
public static byte[] encode(Tensor tensor) {
GrowableByteBuffer buffer = new GrowableByteBuffer();
- buffer.putInt1_4Bytes(COMPACT_BINARY_FORMAT_TYPE);
- new CompactBinaryFormat().encode(buffer, tensor);
+ buffer.putInt1_4Bytes(SPARSE_BINARY_FORMAT_TYPE);
+ new SparseBinaryFormat().encode(buffer, tensor);
buffer.flip();
byte[] result = new byte[buffer.remaining()];
buffer.get(result);
@@ -33,8 +33,8 @@ public class TypedBinaryFormat {
GrowableByteBuffer buffer = GrowableByteBuffer.wrap(data);
int formatType = buffer.getInt1_4Bytes();
switch (formatType) {
- case COMPACT_BINARY_FORMAT_TYPE:
- return new CompactBinaryFormat().decode(buffer);
+ case SPARSE_BINARY_FORMAT_TYPE:
+ return new SparseBinaryFormat().decode(buffer);
default:
throw new IllegalArgumentException("Binary format type " + formatType + " is not a known format");
}