@Override public void run() { if (MGR.shutdownInProgress.getAndSet(true)) { LOG.info("Shutdown process invoked a second time: ignoring"); return; } long started = System.currentTimeMillis(); int timeoutCount = executeShutdown(); long ended = System.currentTimeMillis(); LOG.debug(String.format( "Completed shutdown in %.3f seconds; Timeouts: %d", (ended-started)/1000.0, timeoutCount)); // each of the hooks have executed; now shut down the // executor itself. shutdownExecutor(new Configuration()); } }