线程池命名
作者:互联网
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(); }
标签:currentThread,runner,System,namedThreadFactory,线程,命名,executorService 来源: https://www.cnblogs.com/huqi96/p/16478958.html