public class MultithreadingUtils
extends java.lang.Object
| Constructor and Description |
|---|
MultithreadingUtils() |
| Modifier and Type | Method and Description |
|---|---|
static java.util.concurrent.ExecutorService |
buildExecutorService(java.lang.String namePrefix,
int threadCount)
Creates a fixed thread pool executor service with daemon threads and custom naming pattern.
|
static java.util.concurrent.ExecutorService |
buildExecutorService(java.lang.String namePrefix,
ListenerParameters params)
Creates a fixed thread pool executor service with daemon threads using pool size from listener parameters.
|
static void |
shutdownExecutorService(java.util.concurrent.ExecutorService executorService,
long duration,
java.util.concurrent.TimeUnit timeUnit)
Gracefully shuts down an executor service with a specified timeout.
|
public static java.util.concurrent.ExecutorService buildExecutorService(java.lang.String namePrefix,
int threadCount)
namePrefix - prefix for thread names created by this executorthreadCount - number of threads in the poolpublic static java.util.concurrent.ExecutorService buildExecutorService(java.lang.String namePrefix,
ListenerParameters params)
namePrefix - prefix for thread names created by this executorparams - listener parameters containing IO pool size configurationpublic static void shutdownExecutorService(@Nonnull
java.util.concurrent.ExecutorService executorService,
long duration,
@Nonnull
java.util.concurrent.TimeUnit timeUnit)
executorService - the executor service to shut down, must not be nullduration - the maximum time to wait for terminationtimeUnit - the time unit of the duration parameter, must not be null