aboutsummaryrefslogtreecommitdiffstats
path: root/container-search
diff options
context:
space:
mode:
authorBjørn Christian Seime <bjorncs@verizonmedia.com>2021-04-20 14:26:42 +0200
committerBjørn Christian Seime <bjorncs@verizonmedia.com>2021-04-20 14:26:42 +0200
commit6ea24730d0365358fc851a4da7bd346dd2d87d7b (patch)
tree41f815e971ffe8320f2b51a6c4a73275ed8e6523 /container-search
parent24a32dbdd32503c08cb1d75dfb180b4402405160 (diff)
Remove FS4ResourcePool
Diffstat (limited to 'container-search')
-rw-r--r--container-search/src/main/java/com/yahoo/prelude/cluster/ClusterSearcher.java8
-rw-r--r--container-search/src/main/java/com/yahoo/prelude/fastsearch/FS4ResourcePool.java62
-rw-r--r--container-search/src/test/java/com/yahoo/prelude/cluster/ClusterSearcherTestCase.java3
3 files changed, 5 insertions, 68 deletions
diff --git a/container-search/src/main/java/com/yahoo/prelude/cluster/ClusterSearcher.java b/container-search/src/main/java/com/yahoo/prelude/cluster/ClusterSearcher.java
index 37b0fd7ebfb..ccb6e1248b4 100644
--- a/container-search/src/main/java/com/yahoo/prelude/cluster/ClusterSearcher.java
+++ b/container-search/src/main/java/com/yahoo/prelude/cluster/ClusterSearcher.java
@@ -4,12 +4,12 @@ package com.yahoo.prelude.cluster;
import com.yahoo.component.ComponentId;
import com.yahoo.component.chain.dependencies.After;
import com.yahoo.component.provider.ComponentRegistry;
+import com.yahoo.container.QrConfig;
import com.yahoo.container.QrSearchersConfig;
import com.yahoo.container.handler.VipStatus;
import com.yahoo.prelude.IndexFacts;
import com.yahoo.prelude.fastsearch.ClusterParams;
import com.yahoo.prelude.fastsearch.DocumentdbInfoConfig;
-import com.yahoo.prelude.fastsearch.FS4ResourcePool;
import com.yahoo.prelude.fastsearch.FastSearcher;
import com.yahoo.prelude.fastsearch.SummaryParameters;
import com.yahoo.prelude.fastsearch.VespaBackEndSearcher;
@@ -66,7 +66,7 @@ public class ClusterSearcher extends Searcher {
ClusterConfig clusterConfig,
DocumentdbInfoConfig documentDbConfig,
ComponentRegistry<Dispatcher> dispatchers,
- FS4ResourcePool fs4ResourcePool,
+ QrConfig qrConfig,
VipStatus vipStatus) {
super(id);
@@ -92,12 +92,12 @@ public class ClusterSearcher extends Searcher {
}
if (searchClusterConfig.indexingmode() == STREAMING) {
- VdsStreamingSearcher searcher = vdsCluster(fs4ResourcePool.getServerId(), searchClusterIndex,
+ VdsStreamingSearcher searcher = vdsCluster(qrConfig.discriminator(), searchClusterIndex,
searchClusterConfig, docSumParams, documentDbConfig);
addBackendSearcher(searcher);
vipStatus.addToRotation(searcher.getName());
} else {
- FastSearcher searcher = searchDispatch(searchClusterIndex, searchClusterName, fs4ResourcePool.getServerId(),
+ FastSearcher searcher = searchDispatch(searchClusterIndex, searchClusterName, qrConfig.discriminator(),
docSumParams, documentDbConfig, dispatchers);
addBackendSearcher(searcher);
diff --git a/container-search/src/main/java/com/yahoo/prelude/fastsearch/FS4ResourcePool.java b/container-search/src/main/java/com/yahoo/prelude/fastsearch/FS4ResourcePool.java
deleted file mode 100644
index ed9eb72d7dd..00000000000
--- a/container-search/src/main/java/com/yahoo/prelude/fastsearch/FS4ResourcePool.java
+++ /dev/null
@@ -1,62 +0,0 @@
-// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-package com.yahoo.prelude.fastsearch;
-
-import com.google.inject.Inject;
-import com.yahoo.component.AbstractComponent;
-import com.yahoo.concurrent.ThreadFactoryFactory;
-import com.yahoo.container.QrConfig;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.ScheduledExecutorService;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicInteger;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-/**
- * All users will get the same pool instance.
- *
- * @author baldersheim
- */
-public class FS4ResourcePool extends AbstractComponent {
-
- private static final Logger logger = Logger.getLogger(FS4ResourcePool.class.getName());
- private static final AtomicInteger instanceCounter = new AtomicInteger(0);
- private final String serverId;
- private final int instanceId;
- private final ExecutorService executor;
- private final ScheduledExecutorService scheduledExecutor;
-
- @Inject
- public FS4ResourcePool(QrConfig config) {
- this(config.discriminator());
- }
-
- public FS4ResourcePool(String serverId) {
- this.serverId = serverId;
- instanceId = instanceCounter.getAndIncrement();
- String name = "FS4-" + instanceId;
- executor = Executors.newCachedThreadPool(ThreadFactoryFactory.getDaemonThreadFactory(name));
- scheduledExecutor = Executors.newScheduledThreadPool(1, ThreadFactoryFactory.getDaemonThreadFactory(name + ".scheduled"));
- }
-
- /** Returns an unique identifier of the server this runs in */
- public String getServerId() { return serverId; }
- public ExecutorService getExecutor() { return executor; }
- public ScheduledExecutorService getScheduledExecutor() { return scheduledExecutor; }
-
- @Override
- public void deconstruct() {
- logger.log(Level.INFO, "Deconstructing FS4ResourcePool with id '" + instanceId + "'.");
- super.deconstruct();
- executor.shutdown();
- scheduledExecutor.shutdown();
- try {
- executor.awaitTermination(10, TimeUnit.SECONDS);
- scheduledExecutor.awaitTermination(10, TimeUnit.SECONDS);
- } catch (InterruptedException e) {
- logger.warning("Executors failed terminating within timeout of 10 seconds : " + e);
- }
- }
-
-}
diff --git a/container-search/src/test/java/com/yahoo/prelude/cluster/ClusterSearcherTestCase.java b/container-search/src/test/java/com/yahoo/prelude/cluster/ClusterSearcherTestCase.java
index 8b7a57c38e7..f4608f1c991 100644
--- a/container-search/src/test/java/com/yahoo/prelude/cluster/ClusterSearcherTestCase.java
+++ b/container-search/src/test/java/com/yahoo/prelude/cluster/ClusterSearcherTestCase.java
@@ -14,7 +14,6 @@ import com.yahoo.prelude.IndexFacts;
import com.yahoo.prelude.IndexModel;
import com.yahoo.prelude.SearchDefinition;
import com.yahoo.prelude.fastsearch.DocumentdbInfoConfig;
-import com.yahoo.prelude.fastsearch.FS4ResourcePool;
import com.yahoo.prelude.fastsearch.FastHit;
import com.yahoo.prelude.fastsearch.VespaBackEndSearcher;
import com.yahoo.prelude.fastsearch.test.MockMetric;
@@ -530,7 +529,7 @@ public class ClusterSearcherTestCase {
clusterConfig.build(),
documentDbConfig.build(),
dispatchers,
- new FS4ResourcePool(new QrConfig.Builder().build()),
+ new QrConfig.Builder().build(),
vipStatus);
}