public CcId registerNode(CcConnection ccc) throws Exception {
LOGGER.info("Registering with Cluster Controller {}", ccc);
int registrationId = nextRegistrationId.incrementAndGet();
pendingRegistrations.put(registrationId, ccc);
CcId ccId = ccc.registerNode(nodeRegistration, registrationId);
ccMap.put(ccId, ccc);
ccAddressMap.put(ccc.getCcAddress(), ccId);
Serializable distributedState = ccc.getNodeParameters().getDistributedState();
if (distributedState != null) {
getDistributedState().put(ccId, distributedState);
}
IClusterController ccs = ccc.getClusterControllerService();
NodeParameters nodeParameters = ccc.getNodeParameters();
heartbeatManagers.computeIfAbsent(ccId, newCcId -> HeartbeatManager.init(this, ccc, hbTask.getHeartbeatData(),
nodeRegistration.getNodeControllerAddress()));
if (!ccTimers.containsKey(ccId) && nodeParameters.getProfileDumpPeriod() > 0) {
Timer ccTimer = new Timer("Timer-" + ccId, true);
ccTimer.schedule(new ProfileDumpTask(ccs, ccId), 0, nodeParameters.getProfileDumpPeriod());
ccTimers.put(ccId, ccTimer);
}
ccc.notifyRegistrationCompleted();
LOGGER.info("Registering with Cluster Controller {} completed", ccc);
return ccId;
}