import java.util.*;
import java.util.concurrent.*;
public class TestThreadPoolService {
//可用的cpu数量
private static final int CPU_COUNT = Runtime.getRuntime().availableProcessors();
//阻塞队列大小
private static final BlockingQueue WORK_QUEUE = new linkedBlockingQueue(10*1000);
// 根据系统配置设置合适的核心线程数、最大线程数、等待队列等参数。
// 这个需要按照实际业务进行设置,需要考虑当前业务是IO密集和CPU密集
private static final ExecutorService executor = new ThreadPoolExecutor(CPU_COUNT * 4 + 1, CPU_COUNT * 10 + 1, 1L, TimeUnit.MINUTES, WORK_QUEUE, Executors.defaultThreadFactory(),
new ThreadPoolExecutor.CallerRunsPolicy()
);
private void testThreadPool(List orderIds) throws InterruptedException, ExecutionException {
CompletionService