关闭时可使用如下代码 public static void waitUntilTerminate(final ExecutorService executorService, final int timeout) { try { executorService.shutdown(); if (!executorService.awaitTermination(timeout, TimeUnit.SECONDS)) { //超时后直接关闭 executorService.shutdownNow(); } } catch (In