Java tutorial
//package com.java2s; //License from project: Apache License import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; public class Main { public static final int STANDARD_THREAD_COUNT = 10000; static ExecutorService executorService = Executors.newFixedThreadPool(6); public static boolean shutdown() { try { executorService.shutdown(); return executorService.awaitTermination(STANDARD_THREAD_COUNT / 100, TimeUnit.SECONDS); } catch (InterruptedException e) { e.printStackTrace(); return true; } finally { executorService = Executors.newFixedThreadPool(6); } } }