guava创建线程池

private static ListeningExecutorService executorService = MoreExecutors.listeningDecorator(Executors.newCachedThreadPool());
public static void main( String [] args) throws InterruptedException {
executorService.submit(()->{
try {
Thread.sleep(300);
System.out.println("abc");
}
catch (Exception ex){
}
});
System.out.println("end");

}
上一篇:线程池总结


下一篇:Java线程池的四种创建