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.ExecutorDIRECT_EXECUTORShared 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.Executorexecutor(int size, java.lang.String namePrefix)static voidshutdown(java.util.concurrent.Executor executor)To be used with result ofexecutor(int, String)method, shuts down instance if it isExecutorService.static intthreadCount(org.eclipse.aether.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.ExecutorServicethreadPool(int poolSize, java.lang.String namePrefix)Creates new thread poolExecutorService.
-
-
-
Field Detail
-
DIRECT_EXECUTOR
public static final java.util.concurrent.Executor DIRECT_EXECUTOR
Shared instance of "direct executor".
-
-
Constructor Detail
-
ExecutorUtils
public ExecutorUtils()
-
-
Method Detail
-
threadPool
public static java.util.concurrent.ExecutorService threadPool(int poolSize, java.lang.String namePrefix)
Creates new thread poolExecutorService. ThepoolSizeparameter 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(org.eclipse.aether.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 whatConfigUtilsdoes.- Throws:
java.lang.IllegalArgumentException- if default value is less than 1.- See Also:
ConfigUtils.getInteger(RepositorySystemSession, int, String...)
-
-