public class ExecutorTools
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static com.sedmelluq.lava.common.tools.ExecutorTools.CompletedVoidFuture |
COMPLETED_VOID
A completed Future<Void> instance.
|
| Constructor and Description |
|---|
ExecutorTools() |
| Modifier and Type | Method and Description |
|---|---|
static java.util.concurrent.ThreadPoolExecutor |
createEagerlyScalingExecutor(int coreSize,
int maximumSize,
long timeout,
int queueCapacity,
java.util.concurrent.ThreadFactory threadFactory)
Creates an executor which will use the queue only when maximum number of threads has been reached.
|
static void |
shutdownExecutor(java.util.concurrent.ExecutorService executorService,
java.lang.String description)
Shut down an executor and log the shutdown result.
|
public static final com.sedmelluq.lava.common.tools.ExecutorTools.CompletedVoidFuture COMPLETED_VOID
public static void shutdownExecutor(java.util.concurrent.ExecutorService executorService,
java.lang.String description)
executorService - Executor service to shut downdescription - Description of the service to use for loggingpublic static java.util.concurrent.ThreadPoolExecutor createEagerlyScalingExecutor(int coreSize,
int maximumSize,
long timeout,
int queueCapacity,
java.util.concurrent.ThreadFactory threadFactory)
coreSize - Number of threads that are always alivemaximumSize - The maximum number of threads in the pooltimeout - Non-core thread timeout in millisecondsthreadFactory - Thread factory to create pool threads with