public final class ThreadPoolExecutors extends Object
| 限定符和类型 | 类和说明 |
|---|---|
static class |
ThreadPoolExecutors.Builder |
static class |
ThreadPoolExecutors.PrestartCoreThreadType |
| 限定符和类型 | 字段和说明 |
|---|---|
static RejectedExecutionHandler |
ABORT
Throw RejectedExecutionException
|
static RejectedExecutionHandler |
CALLER_BLOCKS
Synchronized put the current task to queue
|
static RejectedExecutionHandler |
CALLER_RUNS
Caller thread run the current task
|
static RejectedExecutionHandler |
CALLER_RUNS_ANYWAY
Anyway always run, ignore the thread pool is whether shutdown
|
static RejectedExecutionHandler |
CALLER_RUNS_OLDEST
Caller thread run the oldest task
|
static RejectedExecutionHandler |
DISCARD
Discard the current task
|
static RejectedExecutionHandler |
DISCARD_OLDEST
Discard oldest and execute the new
|
static String |
DISJOB_COMMON_POOL_SIZE |
static int |
MAX_CAP
max #workers - 1
|
| 构造器和说明 |
|---|
ThreadPoolExecutors() |
| 限定符和类型 | 方法和说明 |
|---|---|
static ThreadPoolExecutors.Builder |
builder() |
static ScheduledThreadPoolExecutor |
commonScheduledPool()
Common ScheduledThreadPoolExecutor
|
static ThreadPoolExecutor |
commonThreadPool()
Common ThreadPoolExecutor, IO bound / IO intensive
|
static boolean |
shutdown(ExecutorService executorService)
Shutdown the ExecutorService safe
|
static boolean |
shutdown(ExecutorService executorService,
int awaitSeconds)
Shutdown the executorService max wait time
|
public static final int MAX_CAP
public static final RejectedExecutionHandler ABORT
public static final RejectedExecutionHandler DISCARD
public static final RejectedExecutionHandler CALLER_RUNS
public static final RejectedExecutionHandler DISCARD_OLDEST
public static final RejectedExecutionHandler CALLER_RUNS_OLDEST
public static final RejectedExecutionHandler CALLER_BLOCKS
public static final RejectedExecutionHandler CALLER_RUNS_ANYWAY
public static ThreadPoolExecutor commonThreadPool()
public static ScheduledThreadPoolExecutor commonScheduledPool()
public static ThreadPoolExecutors.Builder builder()
public static boolean shutdown(ExecutorService executorService)
executorService - the executorServicepublic static boolean shutdown(ExecutorService executorService, int awaitSeconds)
executorService - the executorServiceawaitSeconds - await time secondstrue if safe terminateCopyright © 2025. All rights reserved.