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
http://www.javashuo.com/article/p-zfnvmiws-bn.html
https://coach.iteye.com/blog/855850html
https://www.twle.cn/c/yufei/javatm/javatm-basic-google-guava.htmljava