Java examples for java.util.concurrent:Executors
shut Down Executor Service And Await Termination
//package com.java2s; import java.util.concurrent.ExecutorService; import java.util.concurrent.TimeUnit; public class Main { public static void shutDownExecutorServiceAndAwaitTermination( ExecutorService executorService, long timeout, TimeUnit timeUnit) { try {//from w w w.j a v a2 s . c o m executorService.shutdown(); executorService.awaitTermination(timeout, timeUnit); } catch (InterruptedException e) { executorService.shutdownNow(); } } }