public class ThreadPoolUtils extends Object
| 限定符和类型 | 方法和说明 |
|---|---|
static ExecutorService |
createThreadPool(Integer coreSize,
String threadNamePrefix)
一般情况推荐使用参数
|
static ExecutorService |
createThreadPool(int corePoolSize,
int maximumPoolSize,
long keepAliveTime,
TimeUnit unit,
BlockingQueue<Runnable> workQueue,
RejectedExecutionHandler handler) |
static ExecutorService |
createThreadPool(int corePoolSize,
int maximumPoolSize,
long keepAliveTime,
TimeUnit unit,
BlockingQueue<Runnable> workQueue,
String threadNamePrefix) |
static ExecutorService |
createThreadPool(int corePoolSize,
int maximumPoolSize,
long keepAliveTime,
TimeUnit unit,
BlockingQueue<Runnable> workQueue,
ThreadFactory threadFactory) |
static ExecutorService |
createThreadPool(int corePoolSize,
int maximumPoolSize,
long keepAliveTime,
TimeUnit unit,
BlockingQueue<Runnable> workQueue,
ThreadFactory threadFactory,
RejectedExecutionHandler handler) |
static ExecutorService |
createThreadPool(String threadNamePrefix)
一般情况推荐使用参数
|
static ExecutorService |
createThreadPool(String threadNamePrefix,
Integer taskQueueSize)
一般情况推荐使用参数
|
static ScheduledExecutorService |
newScheduledThreadPool(int corePoolSize) |
static ScheduledExecutorService |
newScheduledThreadPool(int corePoolSize,
ThreadFactory threadFactory) |
static void |
shutdown()
关闭应用时调用,关闭其他线程池资源
|
public static ExecutorService createThreadPool(String threadNamePrefix)
threadNamePrefix - 线程前缀,默认coreSize 为10public static ExecutorService createThreadPool(Integer coreSize, String threadNamePrefix)
threadNamePrefix - 线程前缀,默认coreSize 为10public static ExecutorService createThreadPool(String threadNamePrefix, Integer taskQueueSize)
threadNamePrefix - 线程前缀public static ExecutorService createThreadPool(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue<Runnable> workQueue, String threadNamePrefix)
public static ExecutorService createThreadPool(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue<Runnable> workQueue, ThreadFactory threadFactory)
public static ExecutorService createThreadPool(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue<Runnable> workQueue, RejectedExecutionHandler handler)
public static ExecutorService createThreadPool(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue<Runnable> workQueue, ThreadFactory threadFactory, RejectedExecutionHandler handler)
public static ScheduledExecutorService newScheduledThreadPool(int corePoolSize)
public static ScheduledExecutorService newScheduledThreadPool(int corePoolSize, ThreadFactory threadFactory)
public static void shutdown()
Copyright © 2024. All rights reserved.