// 创建线程池
ExecutorService executorService = Executors.newFixedThreadPool(20);
// 提交线程任务
executorService.submit();
//不在接收新的任务
executorService.shutdown();
try {
// 等待所有线程执行完毕
executorService.awaitTermination(Long.MAX_VALUE,TimeUnit.NANOSECONDS);
} catch (InterruptedException e) {
log.error(e.getMessage());
}