diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2019-09-17 22:20:21 +0200 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2019-09-17 22:20:21 +0200 |
commit | fdfb66f632c60cb006e83b7a83ab129ff8e040a5 (patch) | |
tree | 2856305bc733d52b7e6a26e0a36afacef8209ccb /container-search | |
parent | e82ecaff7764c0bc14213c3e25ffd08747dcc5d2 (diff) |
Some more cleanup
Diffstat (limited to 'container-search')
-rw-r--r-- | container-search/src/main/java/com/yahoo/search/dispatch/searchcluster/SearchCluster.java | 14 | ||||
-rw-r--r-- | container-search/src/test/java/com/yahoo/search/dispatch/MockSearchCluster.java | 5 |
2 files changed, 3 insertions, 16 deletions
diff --git a/container-search/src/main/java/com/yahoo/search/dispatch/searchcluster/SearchCluster.java b/container-search/src/main/java/com/yahoo/search/dispatch/searchcluster/SearchCluster.java index 3657e0b5c76..dc35ebdc65f 100644 --- a/container-search/src/main/java/com/yahoo/search/dispatch/searchcluster/SearchCluster.java +++ b/container-search/src/main/java/com/yahoo/search/dispatch/searchcluster/SearchCluster.java @@ -186,17 +186,11 @@ public class SearchCluster implements NodeManager<Node> { } /** - * Returns the nodes of this cluster as an immutable map indexed by host. - * One host may contain multiple nodes (on different ports), so this is a multi-map. - */ - public ImmutableMultimap<String, Node> nodesByHost() { return nodesByHost; } - - /** * Returns the recipient we should dispatch queries directly to (bypassing fdispatch), * or empty if we should not dispatch directly. */ public Optional<Node> directDispatchTarget() { - if ( ! directDispatchTarget.isPresent()) return Optional.empty(); + if ( directDispatchTarget.isEmpty()) return Optional.empty(); // Only use direct dispatch if the local group has sufficient coverage Group localSearchGroup = groups.get(directDispatchTarget.get().group()); @@ -240,13 +234,11 @@ public class SearchCluster implements NodeManager<Node> { } private boolean usesDirectDispatchTo(Node node) { - if ( ! directDispatchTarget.isPresent()) return false; - return directDispatchTarget.get().equals(node); + return directDispatchTarget.isPresent() && directDispatchTarget.get().equals(node); } private boolean usesDirectDispatchTo(Group group) { - if ( ! directDispatchTarget.isPresent()) return false; - return directDispatchTarget.get().group() == group.id(); + return directDispatchTarget.isPresent() && directDispatchTarget.get().group() == group.id(); } /** Used by the cluster monitor to manage node status */ diff --git a/container-search/src/test/java/com/yahoo/search/dispatch/MockSearchCluster.java b/container-search/src/test/java/com/yahoo/search/dispatch/MockSearchCluster.java index 42a22f6f86b..7ee62ae9978 100644 --- a/container-search/src/test/java/com/yahoo/search/dispatch/MockSearchCluster.java +++ b/container-search/src/test/java/com/yahoo/search/dispatch/MockSearchCluster.java @@ -89,11 +89,6 @@ public class MockSearchCluster extends SearchCluster { } @Override - public ImmutableMultimap<String, Node> nodesByHost() { - return nodesByHost; - } - - @Override public Optional<Node> directDispatchTarget() { return Optional.empty(); } |