HookEntry(Runnable hook, int priority) { this(hook, priority, getShutdownTimeout(new Configuration()), TIME_UNIT_DEFAULT); }
/** * Shutdown the executor thread itself. * @param conf the configuration containing the shutdown timeout setting. */ private static void shutdownExecutor(final Configuration conf) { try { EXECUTOR.shutdown(); long shutdownTimeout = getShutdownTimeout(conf); if (!EXECUTOR.awaitTermination( shutdownTimeout, TIME_UNIT_DEFAULT)) { // timeout waiting for the LOG.error("ShutdownHookManger shutdown forcefully after" + " {} seconds.", shutdownTimeout); EXECUTOR.shutdownNow(); } LOG.debug("ShutdownHookManger completed shutdown."); } catch (InterruptedException ex) { // interrupted. LOG.error("ShutdownHookManger interrupted while waiting for " + "termination.", ex); EXECUTOR.shutdownNow(); Thread.currentThread().interrupt(); } }