Package org.opennms.core.concurrent
Class ExecutorFactoryJavaImpl
- java.lang.Object
-
- org.opennms.core.concurrent.ExecutorFactoryJavaImpl
-
- All Implemented Interfaces:
ExecutorFactory
public class ExecutorFactoryJavaImpl extends Object implements ExecutorFactory
-
-
Constructor Summary
Constructors Constructor Description ExecutorFactoryJavaImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ExecutorServicenewExecutor(int threads, int queueSize, String daemonName, String executorName)Construct a newExecutorServicewith a specified queue size for the backlog of tasks.ExecutorServicenewExecutor(int threads, String daemonName, String executorName)Construct a newExecutorServicewith an unbounded queue size ({@link 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 thethreadsparameter to ensure that the CPU is fully utilized.ExecutorServicenewExecutor(String daemonName, String executorName)Construct a newExecutorServicewith an unbounded queue size and a thread pool size equal to the value ofRuntime.availableProcessors()so that one thread per core is started.
-
-
-
Method Detail
-
newExecutor
public ExecutorService newExecutor(String daemonName, String executorName)
Description copied from interface:ExecutorFactoryConstruct a newExecutorServicewith an unbounded queue size and a thread pool size equal to the value ofRuntime.availableProcessors()so that one thread per core is started.- Specified by:
newExecutorin interfaceExecutorFactory- Returns:
-
newExecutor
public ExecutorService newExecutor(int threads, String daemonName, String executorName)
Description copied from interface:ExecutorFactoryConstruct a newExecutorServicewith an unbounded queue size ({@link 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 thethreadsparameter to ensure that the CPU is fully utilized.- Specified by:
newExecutorin interfaceExecutorFactory- Returns:
- An ExecutorService pool
-
newExecutor
public ExecutorService newExecutor(int threads, int queueSize, String daemonName, String executorName)
Description copied from interface:ExecutorFactoryConstruct a newExecutorServicewith 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 theExecutorService. For CPU-intensive tasks, it is a good idea to use the value ofRuntime.availableProcessors()(or a reasonable multiple of it based on the tasks) for thethreadsparameter to ensure that the CPU is fully utilized.- Specified by:
newExecutorin interfaceExecutorFactory- Returns:
- An ExecutorService pool
-
-