public interface ExecutorFactory
ExecutorService
thread pools for use by
daemon processes. This is provided as a service so that thread pools throughout
the system are constructed in the same manner and have consistent thread names,
logging, and queue implementations.Modifier and Type | Method and Description |
---|---|
ExecutorService |
newExecutor(int threads,
int queueSize,
String daemonName,
String executorName)
Construct a new
ExecutorService with a specified queue size for
the backlog of tasks. |
ExecutorService |
newExecutor(int threads,
String daemonName,
String executorName)
Construct a new
ExecutorService with an unbounded queue size
({@link Integer#MAX_VALUE). |
ExecutorService |
newExecutor(String daemonName,
String executorName)
Construct a new
ExecutorService with an unbounded queue size and
a thread pool size equal to the value of Runtime.availableProcessors()
so that one thread per core is started. |
ExecutorService newExecutor(String daemonName, String executorName)
ExecutorService
with an unbounded queue size and
a thread pool size equal to the value of Runtime.availableProcessors()
so that one thread per core is started.daemonName
- executorName
- ExecutorService newExecutor(int threads, String daemonName, String executorName)
ExecutorService
with an unbounded queue size
(Integer#MAX_VALUE).
For CPU-intensive tasks, it is a good idea to use the value of
{@link Runtime#availableProcessors()} (or a reasonable multiple of it
based on the tasks) for the threads
parameter to ensure
that the CPU is fully utilized.threads
- daemonName
- executorName
- ExecutorService newExecutor(int threads, int queueSize, String daemonName, String executorName)
ExecutorService
with a specified queue size for
the backlog of tasks. When the queue is full, the pool may block,
discard the incoming task, or throw an exception. This behavior is
dependent on the implementation of the ExecutorService
.
For CPU-intensive tasks, it is a good idea to use the value of
Runtime.availableProcessors()
(or a reasonable multiple of it
based on the tasks) for the threads
parameter to ensure
that the CPU is fully utilized.threads
- daemonName
- executorName
- Copyright © 2018. All rights reserved.