aboutsummaryrefslogtreecommitdiffstats
path: root/container-search
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2022-03-24 11:36:40 +0100
committerHenning Baldersheim <balder@yahoo-inc.com>2022-03-24 11:36:40 +0100
commitb266a432cfcb25fe958d0c3aedec091970a03f00 (patch)
tree862530679bd25c07ad6d6306f81b3e55822279c4 /container-search
parent474a3523066a906f8113776ec32216eecbbc7458 (diff)
Remember to shutdown common rendering threadpool.
Diffstat (limited to 'container-search')
-rw-r--r--container-search/src/main/java/com/yahoo/search/searchchain/ExecutionFactory.java17
1 files changed, 13 insertions, 4 deletions
diff --git a/container-search/src/main/java/com/yahoo/search/searchchain/ExecutionFactory.java b/container-search/src/main/java/com/yahoo/search/searchchain/ExecutionFactory.java
index 80064dcad3d..28c8ed8f3cf 100644
--- a/container-search/src/main/java/com/yahoo/search/searchchain/ExecutionFactory.java
+++ b/container-search/src/main/java/com/yahoo/search/searchchain/ExecutionFactory.java
@@ -11,7 +11,6 @@ import com.yahoo.component.provider.ComponentRegistry;
import com.yahoo.concurrent.ThreadFactoryFactory;
import com.yahoo.container.QrSearchersConfig;
import com.yahoo.container.core.ChainsConfig;
-import com.yahoo.container.handler.threadpool.ContainerThreadPool;
import com.yahoo.language.Linguistics;
import com.yahoo.language.simple.SimpleLinguistics;
import com.yahoo.prelude.IndexFacts;
@@ -42,6 +41,7 @@ public class ExecutionFactory extends AbstractComponent {
private final IndexFacts indexFacts;
private final SpecialTokenRegistry specialTokens;
private final Linguistics linguistics;
+ private final ThreadPoolExecutor renderingExecutor;
private final RendererRegistry rendererRegistry;
private final Executor executor;
@@ -67,7 +67,8 @@ public class ExecutionFactory extends AbstractComponent {
this.indexFacts = new IndexFacts(new IndexModel(indexInfo, clusters)).freeze();
this.specialTokens = new SpecialTokenRegistry(specialTokens);
this.linguistics = linguistics;
- this.rendererRegistry = new RendererRegistry(renderers.allComponents(), createRenderingExecutor());
+ this.renderingExecutor = createRenderingExecutor();
+ this.rendererRegistry = new RendererRegistry(renderers.allComponents(), renderingExecutor);
this.executor = executor != null ? executor : Executors.newSingleThreadExecutor();
}
@@ -80,7 +81,7 @@ public class ExecutionFactory extends AbstractComponent {
SpecialtokensConfig specialTokens,
Linguistics linguistics,
ComponentRegistry<Renderer> renderers) {
- this(chainsConfig, indexInfo, clusters, searchers, specialTokens, linguistics, renderers, (Executor)null);
+ this(chainsConfig, indexInfo, clusters, searchers, specialTokens, linguistics, renderers, null);
}
private SearchChainRegistry createSearchChainRegistry(ComponentRegistry<Searcher> searchers, ChainsConfig chainsConfig) {
@@ -118,6 +119,14 @@ public class ExecutionFactory extends AbstractComponent {
@Override
public void deconstruct() {
rendererRegistry.deconstruct();
+ renderingExecutor.shutdown();
+ try {
+ if ( ! renderingExecutor.awaitTermination(5, TimeUnit.SECONDS)) {
+ renderingExecutor.shutdownNow();
+ }
+ } catch (InterruptedException e) {
+ renderingExecutor.shutdownNow();
+ }
}
public static ExecutionFactory empty() {
@@ -128,7 +137,7 @@ public class ExecutionFactory extends AbstractComponent {
new SpecialtokensConfig.Builder().build(),
new SimpleLinguistics(),
new ComponentRegistry<>(),
- (Executor)null);
+ null);
}
}