public final class SharedScheduledExecutors
extends java.lang.Object
Whenever possible, use of these shared resources is encouraged over creating separate ones.
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_POOL_SIZE |
Modifier and Type | Method and Description |
---|---|
static SharedScheduledExecutorService |
getPoolThreadExecutor()
Returns the shared scheduled thread pool executor.
|
static SharedScheduledExecutorService |
getSingleThreadExecutor()
Returns the shared scheduled single thread executor.
|
static java.util.concurrent.ScheduledFuture<?> |
newTimeout(java.lang.Runnable task,
long delay,
java.util.concurrent.TimeUnit unit)
Executes one-shot timer task on shared thread pool.
|
static void |
setPoolSize(int poolSize)
Configures the shared scheduled thread pool size.
|
static void |
shutdown()
Shuts down all shared scheduled executors.
|
public static final int DEFAULT_POOL_SIZE
public static SharedScheduledExecutorService getSingleThreadExecutor()
public static java.util.concurrent.ScheduledFuture<?> newTimeout(java.lang.Runnable task, long delay, java.util.concurrent.TimeUnit unit)
task
- timer task to executedelay
- before executing the taskunit
- of delaypublic static SharedScheduledExecutorService getPoolThreadExecutor()
public static void setPoolSize(int poolSize)
poolSize
- new pool sizepublic static void shutdown()