diff --git a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/statemachine/DatanodeStateMachine.java b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/statemachine/DatanodeStateMachine.java index a4ea31e420..8d2df2c4f2 100644 --- a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/statemachine/DatanodeStateMachine.java +++ b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/statemachine/DatanodeStateMachine.java @@ -363,8 +363,13 @@ public void triggerHeartbeat() { * @throws InterruptedException */ public void join() throws InterruptedException { - stateMachineThread.join(); - cmdProcessThread.join(); + if (stateMachineThread != null) { + stateMachineThread.join(); + } + + if (cmdProcessThread != null) { + cmdProcessThread.join(); + } } /**