Here you can find the source of awaitTermination(ExecutorService service, Logger logger, Duration timeout, String technique)
public static boolean awaitTermination(ExecutorService service, Logger logger, Duration timeout, String technique)
//package com.java2s; //License from project: Open Source License import java.time.Duration; import java.util.concurrent.ExecutorService; import java.util.concurrent.TimeUnit; import java.util.logging.Logger; public class Main { /**/* w w w .j a va 2 s . co m*/ * Await termination of the given {@link ExecutorService}. If it does not terminate within the * given time, log a severe error to the given logger, mentioning that the given technique was * used to try and shut it down. * * @return true if the executor terminated in time, false if it timed out */ public static boolean awaitTermination(ExecutorService service, Logger logger, Duration timeout, String technique) { try { service.awaitTermination(timeout.toMillis(), TimeUnit.MILLISECONDS); return true; } catch (InterruptedException e) { logger.severe(technique + " shutdown of " + service + " did not complete within " + timeout); return false; } } }