public static void main(String[] args) { //guava 创建线程池 //https://blog.csdn.net/chinabestchina/article/details/89527931
ExecutorService executorService = new ThreadPoolExecutor(2,5,30,TimeUnit.SECONDS, new LinkedBlockingDeque<>(),new ThreadFactoryBuilder().setNameFormat("cs-m-%d").build(),new ThreadPoolExecutor.DiscardOldestPolicy()); ListeningExecutorService listeningExecutorService = MoreExecutors.listeningDecorator(executorService); listeningExecutorService.submit(()-> System.out.println(Thread.currentThread().getName()+ "===1")); listeningExecutorService.submit(()-> System.out.println(Thread.currentThread().getName()+ "===2")); listeningExecutorService.submit(()-> System.out.println(Thread.currentThread().getName()+ "===3")); listeningExecutorService.shutdown(); }
https://blog.csdn.net/chinabestchina/article/details/89527931#41_MoreExecutors_53
https://www.cnblogs.com/yszzu/p/10122658.html
https://coach.iteye.com/blog/855850
https://www.twle.cn/c/yufei/javatm/javatm-basic-google-guava.html