aboutsummaryrefslogtreecommitdiffstats
path: root/container-core
diff options
context:
space:
mode:
authorBjørn Christian Seime <bjorncs@verizonmedia.com>2022-04-19 11:29:55 +0200
committerBjørn Christian Seime <bjorncs@verizonmedia.com>2022-04-19 13:35:09 +0200
commitd965890a02a55f2761ef65e81185747084e37684 (patch)
tree092bc3e854b68ec861ec420383edd70d4846a7c1 /container-core
parent607ba8c0e577e318890d9f253187ac290cf5eb05 (diff)
Improve class names for the container threadpools
Diffstat (limited to 'container-core')
-rw-r--r--container-core/src/main/java/com/yahoo/container/handler/ThreadPoolProvider.java11
-rw-r--r--container-core/src/main/java/com/yahoo/container/handler/threadpool/ContainerThreadpoolImpl.java (renamed from container-core/src/main/java/com/yahoo/container/handler/threadpool/DefaultContainerThreadpool.java)12
-rw-r--r--container-core/src/test/java/com/yahoo/container/handler/threadpool/ContainerThreadPoolImplTest.java (renamed from container-core/src/test/java/com/yahoo/container/handler/threadpool/DefaultContainerThreadPoolTest.java)8
3 files changed, 16 insertions, 15 deletions
diff --git a/container-core/src/main/java/com/yahoo/container/handler/ThreadPoolProvider.java b/container-core/src/main/java/com/yahoo/container/handler/ThreadPoolProvider.java
index bc3c35cb78e..1818a3d97b4 100644
--- a/container-core/src/main/java/com/yahoo/container/handler/ThreadPoolProvider.java
+++ b/container-core/src/main/java/com/yahoo/container/handler/ThreadPoolProvider.java
@@ -6,15 +6,16 @@ import com.yahoo.component.AbstractComponent;
import com.yahoo.container.di.componentgraph.Provider;
import com.yahoo.container.handler.threadpool.ContainerThreadPool;
import com.yahoo.container.handler.threadpool.ContainerThreadpoolConfig;
-import com.yahoo.container.handler.threadpool.DefaultContainerThreadpool;
+import com.yahoo.container.handler.threadpool.ContainerThreadpoolImpl;
import com.yahoo.container.protect.ProcessTerminator;
import com.yahoo.jdisc.Metric;
import java.util.concurrent.Executor;
/**
- * A configurable thread pool provider. This provides the worker threads used for normal request processing.
- * Request an Executor injected in your component constructor if you want to use it.
+ * A configurable thread pool provider for the jdisc default threadpool.
+ * This provides the worker threads used for normal request processing.
+ * Request an {@link Executor} injected in your component constructor if you want to use it.
*
* @author Steinar Knutsen
* @author baldersheim
@@ -26,11 +27,11 @@ public class ThreadPoolProvider extends AbstractComponent implements Provider<Ex
@Inject
public ThreadPoolProvider(ThreadpoolConfig config, Metric metric) {
- this.threadpool = new DefaultContainerThreadpool(translateConfig(config), metric);
+ this.threadpool = new ContainerThreadpoolImpl(translateConfig(config), metric);
}
public ThreadPoolProvider(ThreadpoolConfig config, Metric metric, ProcessTerminator processTerminator) {
- this.threadpool = new DefaultContainerThreadpool(translateConfig(config), metric, processTerminator);
+ this.threadpool = new ContainerThreadpoolImpl(translateConfig(config), metric, processTerminator);
}
/**
diff --git a/container-core/src/main/java/com/yahoo/container/handler/threadpool/DefaultContainerThreadpool.java b/container-core/src/main/java/com/yahoo/container/handler/threadpool/ContainerThreadpoolImpl.java
index 638336e51d8..73845c13fe8 100644
--- a/container-core/src/main/java/com/yahoo/container/handler/threadpool/DefaultContainerThreadpool.java
+++ b/container-core/src/main/java/com/yahoo/container/handler/threadpool/ContainerThreadpoolImpl.java
@@ -22,25 +22,25 @@ import java.util.logging.Logger;
* @author bratseth
* @author bjorncs
*/
-public class DefaultContainerThreadpool extends AbstractComponent implements AutoCloseable, ContainerThreadPool {
+public class ContainerThreadpoolImpl extends AbstractComponent implements AutoCloseable, ContainerThreadPool {
- private static final Logger log = Logger.getLogger(DefaultContainerThreadpool.class.getName());
+ private static final Logger log = Logger.getLogger(ContainerThreadpoolImpl.class.getName());
private static final int MIN_QUEUE_SIZE = 650;
private static final int MIN_THREADS_WHEN_SCALE_FACTOR = 8;
private final ExecutorServiceWrapper threadpool;
@Inject
- public DefaultContainerThreadpool(ContainerThreadpoolConfig config, Metric metric) {
+ public ContainerThreadpoolImpl(ContainerThreadpoolConfig config, Metric metric) {
this(config, metric, new ProcessTerminator());
}
- public DefaultContainerThreadpool(ContainerThreadpoolConfig config, Metric metric, ProcessTerminator processTerminator) {
+ public ContainerThreadpoolImpl(ContainerThreadpoolConfig config, Metric metric, ProcessTerminator processTerminator) {
this(config, metric, processTerminator, Runtime.getRuntime().availableProcessors());
}
- DefaultContainerThreadpool(ContainerThreadpoolConfig config, Metric metric, ProcessTerminator processTerminator,
- int cpus) {
+ ContainerThreadpoolImpl(ContainerThreadpoolConfig config, Metric metric, ProcessTerminator processTerminator,
+ int cpus) {
String name = config.name();
int maxThreads = maxThreads(config, cpus);
int minThreads = minThreads(config, maxThreads, cpus);
diff --git a/container-core/src/test/java/com/yahoo/container/handler/threadpool/DefaultContainerThreadPoolTest.java b/container-core/src/test/java/com/yahoo/container/handler/threadpool/ContainerThreadPoolImplTest.java
index b56d89cafb3..536f7f599f2 100644
--- a/container-core/src/test/java/com/yahoo/container/handler/threadpool/DefaultContainerThreadPoolTest.java
+++ b/container-core/src/test/java/com/yahoo/container/handler/threadpool/ContainerThreadPoolImplTest.java
@@ -20,7 +20,7 @@ import static org.junit.Assert.fail;
* @author Steinar Knutsen
* @author bjorncs
*/
-public class DefaultContainerThreadPoolTest {
+public class ContainerThreadPoolImplTest {
private static final int CPUS = 16;
@@ -28,7 +28,7 @@ public class DefaultContainerThreadPoolTest {
public final void testThreadPool() throws InterruptedException {
Metric metrics = new MetricMock();
ContainerThreadpoolConfig config = new ContainerThreadpoolConfig(new ContainerThreadpoolConfig.Builder().maxThreads(1));
- ContainerThreadPool threadPool = new DefaultContainerThreadpool(config, metrics);
+ ContainerThreadPool threadPool = new ContainerThreadpoolImpl(config, metrics);
Executor exec = threadPool.executor();
Tuple2<Receiver.MessageState, Boolean> reply;
FlipIt command = new FlipIt();
@@ -66,7 +66,7 @@ public class DefaultContainerThreadPoolTest {
.maxThreads(maxThreads)
.minThreads(maxThreads)
.queueSize(queueSize));
- ContainerThreadPool threadPool = new DefaultContainerThreadpool(
+ ContainerThreadPool threadPool = new ContainerThreadpoolImpl(
config, metric, new MockProcessTerminator(), CPUS);
ExecutorServiceWrapper wrapper = (ExecutorServiceWrapper) threadPool.executor();
WorkerCompletionTimingThreadPoolExecutor executor = (WorkerCompletionTimingThreadPoolExecutor)wrapper.delegate();
@@ -128,7 +128,7 @@ public class DefaultContainerThreadPoolTest {
.maxThreadExecutionTimeSeconds(1));
MockProcessTerminator terminator = new MockProcessTerminator();
Metric metrics = new MetricMock();
- ContainerThreadPool threadPool = new DefaultContainerThreadpool(config, metrics, terminator);
+ ContainerThreadPool threadPool = new ContainerThreadpoolImpl(config, metrics, terminator);
// No dying when threads hang shorter than max thread execution time
threadPool.executor().execute(new Hang(500));