@@ -151,6 +151,13 @@ public class ScheduledKit {
executor.shutdownNow();
}
+
+ /**
+ * 在 shutdown 线程池之后,阻塞等待所有任务执行完,或发生超时,或当前线程中断,以先发生者为准
+ */
+ public static boolean awaitTermination(long timeout, TimeUnit unit) throws InterruptedException {
+ return executor == null || executor.awaitTermination(timeout, unit);
+ }