Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import java.util.concurrent.ExecutorService;

import java.util.concurrent.TimeUnit;

public class Main {
    public static void gracefulShutdown(ExecutorService pool, int shutdownTimeout, int shutdownNowTimeout,
            TimeUnit timeUnit) {
        pool.shutdown();

        try {
            if (!pool.awaitTermination((long) shutdownTimeout, timeUnit)) {
                pool.shutdownNow();
                if (!pool.awaitTermination((long) shutdownNowTimeout, timeUnit)) {
                    System.err.println("Pool did not terminated");
                }
            }
        } catch (InterruptedException var5) {
            pool.shutdownNow();
            Thread.currentThread().interrupt();
        }

    }
}