手动创建线程池ThreadPoolExecutor
public class ThreadPoolHelper {
private static ThreadPoolExecutor THREAD_POOL_EXECUTOR = new ThreadPoolExecutor(
10,
50,
1,
TimeUnit.HOURS,
new ArrayBlockingQueue<>(1000),
Executors.defaultThreadFactory()
);
public static ThreadPoolExecutor getThreadPoolExecutor() {
return THREAD_POOL_EXECUTOR;
}
}