io.github.wycst.wast.common.utils.ExecutorServiceUtils Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of wast Show documentation
Show all versions of wast Show documentation
Wast is a high-performance Java toolset library package that includes JSON, YAML, CSV, HttpClient, JDBC and EL engines
package io.github.wycst.wast.common.utils;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.TimeUnit;
/**
* @Author: wangy
* @Date: 2021/8/9 22:42
* @Description:
*/
public final class ExecutorServiceUtils {
/**
* 关闭线程池
*
* @param executorService
*/
public static void shutdownExecutorService(ExecutorService executorService) {
try {
executorService.shutdown();
if (!executorService.awaitTermination(5000, TimeUnit.MILLISECONDS)) {
executorService.shutdownNow();
}
} catch (Throwable e) {
try {
executorService.shutdownNow();
} catch (Throwable throwable) {
}
}
}
}