[
https://issues.apache.org/jira/browse/HADOOP-12950?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15216885#comment-15216885
]
Jing Zhao commented on HADOOP-12950:
------------------------------------
Thanks for working on this, [~xyao]! The patch looks good to me. Some minor
comments:
# Do you think we should only create daemon thread for the executor?
{code}
51 private static final ExecutorService EXECUTOR =
52 HadoopExecutors.newSingleThreadExecutor();
{code}
# Since ShutdownHookEntry's hashCode/equals all depend on
ShutdownHookEntry#hook, maybe we can use a SortedMap<Hook, ShutdownHookEntry>
in ShutdownHookManager instead of the current HashSet?
# Feels like the ShutdownHookEntry should still be kept inside of the
ShutdownHookManager, considering it is only used there.
# Nit: 10 can be replaced by TIMEOUT_DEFAULT.
{code}
if (!EXECUTOR.awaitTermination(10, TimeUnit.SECONDS)) {
LOG.error("ShutdownHookManger shutdown forcefully.");
EXECUTOR.shutdownNow();
{code}
> ShutdownHookManager should have a timeout for each of the Registered shutdown
> hook
> ----------------------------------------------------------------------------------
>
> Key: HADOOP-12950
> URL: https://issues.apache.org/jira/browse/HADOOP-12950
> Project: Hadoop Common
> Issue Type: Improvement
> Reporter: Xiaoyu Yao
> Assignee: Xiaoyu Yao
> Attachments: HADOOP-12950.00.patch, HADOOP-12950.01.patch
>
>
> HADOOP-8325 added a ShutdownHookManager to be used by different components
> instead of the JVM shutdownhook. For each of the shutdown hook registered, we
> currently don't have an upper bound for its execution time. We have seen
> namenode failed to shutdown completely (waiting for shutdown hook to finish
> after failover) for a long period of time, which breaks the namenode high
> availability scenarios. This ticket is opened to allow specifying a timeout
> value for the registered shutdown hook.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)