Java Thread Executor Pool normalShutdown(ExecutorService pool, int timeout, TimeUnit timeUnit)

Here you can find the source of normalShutdown(ExecutorService pool, int timeout, TimeUnit timeUnit)

Description

normal Shutdown

License

Open Source License

Declaration

public static void normalShutdown(ExecutorService pool, int timeout, TimeUnit timeUnit) 

Method Source Code


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

import java.util.concurrent.TimeUnit;

public class Main {

    public static void normalShutdown(ExecutorService pool, int timeout, TimeUnit timeUnit) {
        try {//ww  w. jav a  2  s. co  m
            pool.shutdownNow();
            if (!pool.awaitTermination(timeout, timeUnit)) {
                System.err.println("Pool did not terminate");
            }
        } catch (InterruptedException ie) {
            Thread.currentThread().interrupt();
        }
    }
}

Related

  1. getQueuedThreadPool(double threadToCpuRatio, int queueCapacity)
  2. getRecheckThreadPool()
  3. getThreadPool()
  4. getThrealPool()
  5. getTightThreadPool()
  6. safeClose(ExecutorService pool)