public class ThreadPoolFactory extends Object
| 限定符和类型 | 字段和说明 |
|---|---|
static int |
CACHE_THREAD_POOL |
static int |
DEFAULT_THREAD_POOL |
static int |
FIXED_THREAD_POOL |
| 构造器和说明 |
|---|
ThreadPoolFactory() |
| 限定符和类型 | 方法和说明 |
|---|---|
static ExecutorService |
createDefaultThreadPool(String threadNamePrefix) |
static ExecutorService |
createThreadPool(int schema,
String threadNamePrefix,
int queues) |
static ExecutorService |
createThreadPool(int schema,
String threadNamePrefix,
int queues,
boolean daemon) |
static void |
main(String[] args) |
static void |
shutdownAll() |
public static final int FIXED_THREAD_POOL
public static final int DEFAULT_THREAD_POOL
public static final int CACHE_THREAD_POOL
public static void main(String[] args)
public static ExecutorService createDefaultThreadPool(String threadNamePrefix)
public static ExecutorService createThreadPool(int schema, String threadNamePrefix, int queues)
schema - DEFAULT_THREAD_POOL、FIXED_THREAD_POOL、CACHE_THREAD_POOLthreadNamePrefix - 线程池命名,用于线程池的复用queues - 是否为守护线程public static ExecutorService createThreadPool(int schema, String threadNamePrefix, int queues, boolean daemon)
schema - DEFAULT_THREAD_POOL、FIXED_THREAD_POOL、CACHE_THREAD_POOLthreadNamePrefix - 线程池命名,用于线程池的复用queues - 任务队列长度,根据长度选型,小于 0 为 链队列,等于0 为无容量队列,大于0 为daemon - 是否为守护线程public static void shutdownAll()
Copyright © 2025. All rights reserved.