Java tutorial
//package com.java2s; import java.util.concurrent.*; public class Main { public static void normalShutdown(ExecutorService pool, int timeout, TimeUnit timeUnit) { try { pool.shutdownNow(); if (!pool.awaitTermination(timeout, timeUnit)) { System.err.println("Pool did not terminated"); } } catch (InterruptedException ie) { Thread.currentThread().interrupt(); } } }