Class ExecutorUtils
- java.lang.Object
-
- org.eclipse.aether.util.concurrency.ExecutorUtils
-
public final class ExecutorUtils extends java.lang.Object
Utilities for executors and sizing them.- Since:
- 1.9.5
-
-
Field Summary
Fields Modifier and Type Field Description static java.util.concurrent.Executor
DIRECT_EXECUTOR
Shared instance of "direct executor".
-
Constructor Summary
Constructors Constructor Description ExecutorUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.util.concurrent.Executor
executor(int size, java.lang.String namePrefix)
static void
shutdown(java.util.concurrent.Executor executor)
To be used with result ofexecutor(int, String)
method, shuts down instance if it isExecutorService
.static int
threadCount(RepositorySystemSession session, int defaultValue, java.lang.String... keys)
Retrieves and validates requested thread count based on session and specified keys, or if none provided, the provided default value.static java.util.concurrent.ExecutorService
threadPool(int poolSize, java.lang.String namePrefix)
Creates new thread poolExecutorService
.
-
-
-
Method Detail
-
threadPool
public static java.util.concurrent.ExecutorService threadPool(int poolSize, java.lang.String namePrefix)
Creates new thread poolExecutorService
. ThepoolSize
parameter but be greater than 1.
-
executor
public static java.util.concurrent.Executor executor(int size, java.lang.String namePrefix)
-
shutdown
public static void shutdown(java.util.concurrent.Executor executor)
To be used with result ofexecutor(int, String)
method, shuts down instance if it isExecutorService
.
-
threadCount
public static int threadCount(RepositorySystemSession session, int defaultValue, java.lang.String... keys)
Retrieves and validates requested thread count based on session and specified keys, or if none provided, the provided default value. This method validates result on top of whatConfigUtils
does.- Throws:
java.lang.IllegalArgumentException
- if default value is less than 1.- See Also:
ConfigUtils.getInteger(RepositorySystemSession, int, String...)
-
-