public final class AppExecutorUtil
extends java.lang.Object
Constructor and Description |
---|
AppExecutorUtil() |
Modifier and Type | Method and Description |
---|---|
static java.util.concurrent.ExecutorService |
createBoundedApplicationPoolExecutor(java.lang.String name,
java.util.concurrent.Executor backendExecutor,
int maxThreads) |
static java.util.concurrent.ExecutorService |
createBoundedApplicationPoolExecutor(java.lang.String name,
java.util.concurrent.Executor backendExecutor,
int maxThreads,
Disposable parentDisposable) |
static java.util.concurrent.ExecutorService |
createBoundedApplicationPoolExecutor(java.lang.String name,
int maxThreads) |
static java.util.concurrent.ExecutorService |
createBoundedApplicationPoolExecutor(java.lang.String name,
int maxThreads,
boolean changeThreadName) |
static java.util.concurrent.ScheduledExecutorService |
createBoundedScheduledExecutorService(java.lang.String name,
int maxThreads)
Returns
ScheduledExecutorService which allows to ScheduledExecutorService.schedule(Callable, long, TimeUnit) tasks later
and execute them in parallel in the application pool (see getAppExecutorService() not more than at maxThreads at a time. |
static java.util.concurrent.ExecutorService |
createCustomPriorityQueueBoundedApplicationPoolExecutor(java.lang.String name,
java.util.concurrent.Executor backendExecutor,
int maxThreads,
java.util.Comparator<? super java.lang.Runnable> comparator) |
static java.util.concurrent.ExecutorService |
getAppExecutorService()
Application thread pool.
|
static java.util.concurrent.ScheduledExecutorService |
getAppScheduledExecutorService()
Returns application-wide instance of
ScheduledExecutorService which is:
Unbounded. |
public static java.util.concurrent.ScheduledExecutorService getAppScheduledExecutorService()
ScheduledExecutorService
which is:
ScheduledExecutorService.schedule(java.lang.Runnable, long, java.util.concurrent.TimeUnit)
(command, 0, TimeUnit.SECONDS) will lead to multiple executions of the command
in parallel.Application.executeOnPooledThread(Runnable)
ExecutorService.shutdown()
, ExecutorService.shutdownNow()
will be severely punished.ScheduledExecutorService.scheduleAtFixedRate(Runnable, long, long, TimeUnit)
is disallowed because it's bad for hibernation.
Use ScheduledExecutorService.scheduleWithFixedDelay(Runnable, long, long, TimeUnit)
instead.public static java.util.concurrent.ExecutorService getAppExecutorService()
public static java.util.concurrent.ScheduledExecutorService createBoundedScheduledExecutorService(java.lang.String name, int maxThreads)
ScheduledExecutorService
which allows to ScheduledExecutorService.schedule(Callable, long, TimeUnit)
tasks later
and execute them in parallel in the application pool (see getAppExecutorService()
not more than at maxThreads
at a time.public static java.util.concurrent.ExecutorService createBoundedApplicationPoolExecutor(java.lang.String name, int maxThreads)
maxThreads
tasks simultaneously) backed by the application pool
(i.e. all tasks are run in the getAppExecutorService()
global thread pool).getAppExecutorService()
public static java.util.concurrent.ExecutorService createBoundedApplicationPoolExecutor(java.lang.String name, int maxThreads, boolean changeThreadName)
public static java.util.concurrent.ExecutorService createBoundedApplicationPoolExecutor(java.lang.String name, java.util.concurrent.Executor backendExecutor, int maxThreads)
maxThreads
tasks simultaneously) backed by the backendExecutor
public static java.util.concurrent.ExecutorService createBoundedApplicationPoolExecutor(java.lang.String name, java.util.concurrent.Executor backendExecutor, int maxThreads, Disposable parentDisposable)
maxThreads
tasks simultaneously) backed by the backendExecutor
which will shutdown itself when parentDisposable
gets disposed.public static java.util.concurrent.ExecutorService createCustomPriorityQueueBoundedApplicationPoolExecutor(java.lang.String name, java.util.concurrent.Executor backendExecutor, int maxThreads, java.util.Comparator<? super java.lang.Runnable> comparator)
maxThreads
tasks simultaneously) backed by the backendExecutor
which will shutdown itself when parentDisposable
gets disposed.