Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public class DatanodeStateMachine implements Closeable {
private final ReportManager reportManager;
private long commandsHandled;
private final AtomicLong nextHB;
private Thread stateMachineThread = null;
private volatile Thread stateMachineThread = null;
private Thread cmdProcessThread = null;
private final ReplicationSupervisor supervisor;

Expand Down Expand Up @@ -476,7 +476,7 @@ public void startDaemon() {
* be sent by datanode.
*/
public void triggerHeartbeat() {
if (stateMachineThread != null) {
if (stateMachineThread != null && isDaemonStarted()) {
stateMachineThread.interrupt();
}
}
Expand Down Expand Up @@ -517,6 +517,10 @@ public synchronized void stopDaemon() {
}
}

public boolean isDaemonStarted() {
return this.getContext().getExecutionCount() > 0;
}

/**
*
* Check if the datanode state machine daemon is stopped.
Expand Down