diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ha/ZKFailoverController.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ha/ZKFailoverController.java index 91f720a49eed9..1f98e55bcd9fa 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ha/ZKFailoverController.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ha/ZKFailoverController.java @@ -263,8 +263,11 @@ private int doRun(String[] args) rpcServer.stopAndJoin(); elector.quitElection(true); - healthMonitor.shutdown(); - healthMonitor.join(); + + if (healthMonitor != null) { + healthMonitor.shutdown(); + healthMonitor.join(); + } } return 0; }