/** * 公共线程池 * @return */ @Bean public ThreadPoolExecutor commonTreadPool(){ int poolSize = Runtime.getRuntime().availableProcessors() * 2; ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor( poolSize, 50, 30L, TimeUnit.MINUTES, new LinkedBlockingQueue<>(1000), r -> new Thread(r, "common-async-thread-" + r.hashCode())); threadPoolExecutor.allowCoreThreadTimeOut(true); return threadPoolExecutor; }