线程池命名
public static void main(String[] args) throws Exception { //创建线程池 ThreadFactory namedThreadFactory = new ThreadFactoryBuilder().setNameFormat("thread-call-runner-%d").build(); ExecutorService executorService = Executors.newFixedThreadPool(8, namedThreadFactory); for(int i=0;i<100;i++){ executorService.execute(()->{ System.out.println(Thread.currentThread().getName()+"333"); }); } executorService.shutdown(); }