All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.github.wycst.wast.common.utils.ExecutorServiceUtils Maven / Gradle / Ivy

Go to download

Wast is a high-performance Java toolset library package that includes JSON, YAML, CSV, HttpClient, JDBC and EL engines

There is a newer version: 0.0.16
Show newest version
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) {
            }
        }
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy