aboutsummaryrefslogtreecommitdiffstats
path: root/container-search
diff options
context:
space:
mode:
authorArne H Juul <arnej@yahoo-inc.com>2017-02-07 16:17:49 +0100
committerArne H Juul <arnej@yahoo-inc.com>2017-02-07 16:17:52 +0100
commitd3ff1d7cd1523a0e87dc82b0b0dcbc0515b1368c (patch)
treeb32defd0b4ef9dc2492c3cc23dfa86cf5fb430e8 /container-search
parent82fa3755b2f0d613310be2242c09c2fd4de91fb6 (diff)
use documentation comment for expected invariant
* use "assert" only for internally-guaranteed logic
Diffstat (limited to 'container-search')
-rw-r--r--container-search/src/main/java/com/yahoo/prelude/cluster/Hasher.java5
1 files changed, 2 insertions, 3 deletions
diff --git a/container-search/src/main/java/com/yahoo/prelude/cluster/Hasher.java b/container-search/src/main/java/com/yahoo/prelude/cluster/Hasher.java
index 0c0da390616..6298c309be7 100644
--- a/container-search/src/main/java/com/yahoo/prelude/cluster/Hasher.java
+++ b/container-search/src/main/java/com/yahoo/prelude/cluster/Hasher.java
@@ -39,7 +39,6 @@ public class Hasher {
}
static private VespaBackEndSearcher[] addNode(VespaBackEndSearcher node, VespaBackEndSearcher[] oldNodes) {
- assert node != null;
for (VespaBackEndSearcher n : oldNodes) {
if (n == node) return oldNodes; // already present
}
@@ -51,6 +50,7 @@ public class Hasher {
/**
* Make a node available for search.
+ * @param node the backend searcher (must never be null)
*/
public void add(VespaBackEndSearcher node) {
allNodes = addNode(node, allNodes);
@@ -112,7 +112,7 @@ public class Hasher {
/**
* Return a node, prefer local nodes, try to skip already hit nodes.
*
- * @param trynum hint to skip already used nodes
+ * @param trynum hint for skipping (ignored in current implementation)
* @return the selected node, or null if this hasher has no nodes
*/
public VespaBackEndSearcher select(int trynum) {
@@ -128,7 +128,6 @@ public class Hasher {
if (nodes.length > 1) {
idx = Math.abs(avoidAllQrsHitSameTld.incrementAndGet() % nodes.length);
}
- assert nodes[idx] != null;
return nodes[idx];
}