public final class StalkerExecutors extends Object
| 限定符和类型 | 字段和说明 |
|---|---|
static int |
MAX_POOL_SIZE |
| 构造器和说明 |
|---|
StalkerExecutors() |
| 限定符和类型 | 方法和说明 |
|---|---|
static ThreadPoolExecutor |
newFixedThreadExecutor(int corePoolSize,
String threadName)
根据线程名称创建固定数量线程的线程池,最大线程数最多 1024 个.
|
static ScheduledExecutorService |
newScheduledThreadPool(int corePoolSize,
String threadName)
根据线程名称创建新的可调度定时任务的程线程池.
|
static ThreadPoolExecutor |
newSingleThreadExecutor(String threadName)
根据线程名称创建新的单线程线程池.
|
static ThreadPoolExecutor |
newThreadExecutor(int corePoolSize,
int maxPoolSize,
String threadName)
根据线程名称创建固定数量线程的线程池,最大线程数最多 1024 个.
|
static void |
shutdown(ExecutorService... executorServices)
等待所有线程执行完毕,并最终关闭这若干个线程池集合.
|
static void |
shutdownNow(ExecutorService... executorServices)
立即安静的关闭若干个线程池集合.
|
public static final int MAX_POOL_SIZE
public static ThreadPoolExecutor newSingleThreadExecutor(String threadName)
threadName - 线程名称public static ThreadPoolExecutor newFixedThreadExecutor(int corePoolSize, String threadName)
corePoolSize - 核心线程数threadName - 线程名称public static ThreadPoolExecutor newThreadExecutor(int corePoolSize, int maxPoolSize, String threadName)
corePoolSize - 核心线程数maxPoolSize - 最大线程数threadName - 线程名称public static ScheduledExecutorService newScheduledThreadPool(int corePoolSize, String threadName)
corePoolSize - 核心线程数threadName - 线程名称public static void shutdown(ExecutorService... executorServices)
executorServices - 若干个待关闭的线程池执行器集合public static void shutdownNow(ExecutorService... executorServices)
executorServices - 若干个待立即关闭的线程池执行器集合Copyright © 2020. All rights reserved.