summaryrefslogtreecommitdiffstats
path: root/container-core
diff options
context:
space:
mode:
authorBjørn Christian Seime <bjorncs@verizonmedia.com>2020-08-18 15:37:58 +0200
committerBjørn Christian Seime <bjorncs@verizonmedia.com>2020-08-18 15:43:55 +0200
commit0448e37fbcc32fed2de6cf1f11608c6dfee1d9b2 (patch)
tree076701f70d4235eac4add4dadb26ca9bffd45b8a /container-core
parent14cb603facf7860bacade10d442af7f1e1f75305 (diff)
Make ContainerThreadPool a proper component
Diffstat (limited to 'container-core')
-rw-r--r--container-core/src/main/java/com/yahoo/container/handler/threadpool/ContainerThreadPool.java6
1 files changed, 5 insertions, 1 deletions
diff --git a/container-core/src/main/java/com/yahoo/container/handler/threadpool/ContainerThreadPool.java b/container-core/src/main/java/com/yahoo/container/handler/threadpool/ContainerThreadPool.java
index edbe12b64c6..74bcb3a2e04 100644
--- a/container-core/src/main/java/com/yahoo/container/handler/threadpool/ContainerThreadPool.java
+++ b/container-core/src/main/java/com/yahoo/container/handler/threadpool/ContainerThreadPool.java
@@ -1,6 +1,8 @@
// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.container.handler.threadpool;
+import com.google.inject.Inject;
+import com.yahoo.component.AbstractComponent;
import com.yahoo.concurrent.ThreadFactoryFactory;
import com.yahoo.container.handler.ThreadpoolConfig;
import com.yahoo.container.protect.ProcessTerminator;
@@ -20,10 +22,11 @@ import java.util.concurrent.TimeUnit;
* @author bratseth
* @author bjorncs
*/
-public class ContainerThreadPool implements AutoCloseable {
+public class ContainerThreadPool extends AbstractComponent implements AutoCloseable {
private final ExecutorServiceWrapper threadpool;
+ @Inject
public ContainerThreadPool(ThreadpoolConfig config, Metric metric) {
this(config, metric, new ProcessTerminator());
}
@@ -48,6 +51,7 @@ public class ContainerThreadPool implements AutoCloseable {
public Executor executor() { return threadpool; }
@Override public void close() { closeInternal(); }
+ @Override public void deconstruct() { closeInternal(); super.deconstruct(); }
/**
* Shutdown the thread pool, give a grace period of 1 second before forcibly