[NO ISSUE][HYR] Prevent duplicate heartbeat threads on restored IPC connection
Regression in 860fcde
Change-Id: I13833f5c3afc5e17591e112ce0e127a19d7385c9
Reviewed-on: https://asterix-gerrit.ics.uci.edu/2067
Reviewed-by: Michael Blow <mblow@apache.org>
Tested-by: Michael Blow <mblow@apache.org>
diff --git a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/NodeControllerService.java b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/NodeControllerService.java
index 69137e5..4a2c2e9 100644
--- a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/NodeControllerService.java
+++ b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/NodeControllerService.java
@@ -317,6 +317,12 @@
timer.schedule(new ProfileDumpTask(ccs), 0, nodeParameters.getProfileDumpPeriod());
}
+ // Start heartbeat generator.
+ heartbeatThread = new Thread(new HeartbeatTask(ccs, nodeParameters.getHeartbeatPeriod()), id + "-Heartbeat");
+ heartbeatThread.setPriority(Thread.MAX_PRIORITY);
+ heartbeatThread.setDaemon(true);
+ heartbeatThread.start();
+
LOGGER.log(Level.INFO, "Started NodeControllerService");
application.startupCompleted();
}
@@ -354,12 +360,6 @@
registrationException);
throw registrationException;
}
- // Start heartbeat generator.
- heartbeatThread = new Thread(new HeartbeatTask(ccs, nodeParameters.getHeartbeatPeriod()), id + "-Heartbeat");
- heartbeatThread.setPriority(Thread.MAX_PRIORITY);
- heartbeatThread.setDaemon(true);
- heartbeatThread.start();
-
serviceCtx.setDistributedState(nodeParameters.getDistributedState());
application.onRegisterNode();
LOGGER.info("Registering with Cluster Controller complete");