diff options
author | Jon Bratseth <bratseth@gmail.com> | 2021-04-12 16:04:19 +0200 |
---|---|---|
committer | Jon Bratseth <bratseth@gmail.com> | 2021-04-12 16:04:19 +0200 |
commit | 4044f6b8a183c7792d043090c08c3106ed74a656 (patch) | |
tree | c992bd4dbb5f97dbd6e2d8d183adec6b0ac12f83 /container-search/src/main/java/com/yahoo/search/dispatch/Dispatcher.java | |
parent | 64d09cf6b81565e82988507e2112d791e0fba33f (diff) |
Non-functional changes only
Diffstat (limited to 'container-search/src/main/java/com/yahoo/search/dispatch/Dispatcher.java')
-rw-r--r-- | container-search/src/main/java/com/yahoo/search/dispatch/Dispatcher.java | 32 |
1 files changed, 12 insertions, 20 deletions
diff --git a/container-search/src/main/java/com/yahoo/search/dispatch/Dispatcher.java b/container-search/src/main/java/com/yahoo/search/dispatch/Dispatcher.java index 626cf087aca..9b92a78a7c9 100644 --- a/container-search/src/main/java/com/yahoo/search/dispatch/Dispatcher.java +++ b/container-search/src/main/java/com/yahoo/search/dispatch/Dispatcher.java @@ -65,7 +65,7 @@ public class Dispatcher extends AbstractComponent { /** A model of the search cluster this dispatches to */ private final SearchCluster searchCluster; - private final ClusterMonitor clusterMonitor; + private final ClusterMonitor<Node> clusterMonitor; private final LoadBalancer loadBalancer; @@ -108,7 +108,7 @@ public class Dispatcher extends AbstractComponent { } /* Protected for simple mocking in tests. Beware that searchCluster is shutdown on in deconstruct() */ - protected Dispatcher(ClusterMonitor clusterMonitor, + protected Dispatcher(ClusterMonitor<Node> clusterMonitor, SearchCluster searchCluster, DispatchConfig dispatchConfig, InvokerFactory invokerFactory, @@ -125,12 +125,7 @@ public class Dispatcher extends AbstractComponent { this.metricContext = metric.createContext(null); this.maxHitsPerNode = dispatchConfig.maxHitsPerNode(); searchCluster.addMonitoring(clusterMonitor); - Thread warmup = new Thread(new Runnable() { - @Override - public void run() { - warmup(dispatchConfig.warmuptime()); - } - }); + Thread warmup = new Thread(() -> warmup(dispatchConfig.warmuptime())); warmup.start(); try { while ( ! searchCluster.hasInformationAboutAllNodes()) { @@ -139,20 +134,17 @@ public class Dispatcher extends AbstractComponent { warmup.join(); } catch (InterruptedException e) {} - /* - * No we have information from all nodes and a ping iteration has completed. - * Instead of waiting until next ping interval to update coverage and group state, - * we should compute the state ourselves, so that when the dispatcher is ready the state - * of its groups are also known. - */ + // Now we have information from all nodes and a ping iteration has completed. + // Instead of waiting until next ping interval to update coverage and group state, + // we should compute the state ourselves, so that when the dispatcher is ready the state + // of its groups are also known. searchCluster.pingIterationCompleted(); } - /* - Will run important code in order to trigger JIT compilation and avoid cold start issues. - Currently warms up lz4 compression code. + /** + * Will run important code in order to trigger JIT compilation and avoid cold start issues. + * Currently warms up lz4 compression code. */ - private static long warmup(double seconds) { return new Compressor().warmup(seconds); } @@ -164,7 +156,7 @@ public class Dispatcher extends AbstractComponent { @Override public void deconstruct() { - /* The clustermonitor must be shutdown first as it uses the invokerfactory through the searchCluster. */ + // The clustermonitor must be shutdown first as it uses the invokerfactory through the searchCluster. clusterMonitor.shutdown(); invokerFactory.release(); } @@ -212,7 +204,7 @@ public class Dispatcher extends AbstractComponent { return invokerFactory.createSearchInvoker(searcher, query, OptionalInt.empty(), - Arrays.asList(node), + List.of(node), true, maxHitsPerNode) .orElseThrow(() -> new IllegalStateException("Could not dispatch directly to " + node)); |