diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2020-01-31 20:46:05 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2020-01-31 20:46:05 +0000 |
commit | 241612c73b9d9dd00fcf196d9be4bafccc1d305c (patch) | |
tree | f155d73ae8388411289fce9c7e7579d14babe5d1 /container-search/src/test/java/com/yahoo/search/dispatch | |
parent | de5f702fbbce8386b522d1afbc309a2621a387fd (diff) |
Send ping every second truly async to all nodes who does not have any pending pings.
Diffstat (limited to 'container-search/src/test/java/com/yahoo/search/dispatch')
-rw-r--r-- | container-search/src/test/java/com/yahoo/search/dispatch/DispatcherTest.java | 3 | ||||
-rw-r--r-- | container-search/src/test/java/com/yahoo/search/dispatch/searchcluster/SearchClusterTest.java | 14 |
2 files changed, 9 insertions, 8 deletions
diff --git a/container-search/src/test/java/com/yahoo/search/dispatch/DispatcherTest.java b/container-search/src/test/java/com/yahoo/search/dispatch/DispatcherTest.java index de6bafa267a..a369b859b13 100644 --- a/container-search/src/test/java/com/yahoo/search/dispatch/DispatcherTest.java +++ b/container-search/src/test/java/com/yahoo/search/dispatch/DispatcherTest.java @@ -10,6 +10,7 @@ import com.yahoo.search.Result; import com.yahoo.search.cluster.ClusterMonitor; import com.yahoo.search.dispatch.searchcluster.Node; import com.yahoo.search.dispatch.searchcluster.PingFactory; +import com.yahoo.search.dispatch.searchcluster.Pinger; import com.yahoo.search.dispatch.searchcluster.SearchCluster; import org.junit.Test; @@ -142,7 +143,7 @@ public class DispatcherTest { } @Override - public Callable<Pong> createPinger(Node node, ClusterMonitor<Node> monitor) { + public Pinger createPinger(Node node, ClusterMonitor<Node> monitor) { fail("Unexpected call to createPinger"); return null; } diff --git a/container-search/src/test/java/com/yahoo/search/dispatch/searchcluster/SearchClusterTest.java b/container-search/src/test/java/com/yahoo/search/dispatch/searchcluster/SearchClusterTest.java index 69791c46b21..69e3c5cab89 100644 --- a/container-search/src/test/java/com/yahoo/search/dispatch/searchcluster/SearchClusterTest.java +++ b/container-search/src/test/java/com/yahoo/search/dispatch/searchcluster/SearchClusterTest.java @@ -111,21 +111,21 @@ public class SearchClusterTest { static class Factory implements PingFactory { - static class Pinger implements Callable<Pong> { + static class PingJob implements Pinger { private final AtomicInteger numDocs; private final AtomicInteger pingCount; - Pinger(AtomicInteger numDocs, AtomicInteger pingCount) { + PingJob(AtomicInteger numDocs, AtomicInteger pingCount) { this.numDocs = numDocs; this.pingCount = pingCount; } @Override - public Pong call() { + public void ping(PongHandler handler) { int docs = numDocs.get(); pingCount.incrementAndGet(); - return (docs < 0) + handler.handle ((docs < 0) ? new Pong(ErrorMessage.createBackendCommunicationError("Negative numDocs = " + docs)) - : new Pong(docs); + : new Pong(docs)); } } @@ -140,9 +140,9 @@ public class SearchClusterTest { } @Override - public Callable<Pong> createPinger(Node node, ClusterMonitor<Node> monitor) { + public Pinger createPinger(Node node, ClusterMonitor<Node> monitor) { int index = node.group() * numPerGroup + node.key(); - return new Pinger(activeDocs.get(index), pingCounts.get(index)); + return new PingJob(activeDocs.get(index), pingCounts.get(index)); } } |