创建时间: | 2019/1/4 17:09 |
更新时间: | 2019/1/4 17:13 |
spring封装好了的 里面会等待线程跑完
ThreadPoolTaskExecutor threadPoolTaskExecutor = new ThreadPoolTaskExecutor();
threadPoolTaskExecutor.setCorePoolSize(10);
threadPoolTaskExecutor.setWaitForTasksToCompleteOnShutdown(true);
//一分钟
threadPoolTaskExecutor.setAwaitTerminationSeconds(60);
threadPoolTaskExecutor.shutdown();