private void initNodeHeartbeatCache(
      List<TConfigNodeLocation> registeredConfigNodes,
      List<TDataNodeConfiguration> registeredDataNodes,
      List<TAINodeConfiguration> registeredAINodes) {

    final int CURRENT_NODE_ID = ConfigNodeHeartbeatCache.CURRENT_NODE_ID;
    nodeCacheMap.clear();
    heartbeatProcessingMap.clear();

    // Init ConfigNodeHeartbeatCache
    registeredConfigNodes.forEach(
        configNodeLocation -> {
          int configNodeId = configNodeLocation.getConfigNodeId();
          if (configNodeId != CURRENT_NODE_ID) {
            createNodeHeartbeatCache(NodeType.ConfigNode, configNodeId);
          }
        });
    // Force set itself and never update
    nodeCacheMap.put(
        ConfigNodeHeartbeatCache.CURRENT_NODE_ID,
        new ConfigNodeHeartbeatCache(
            CURRENT_NODE_ID, ConfigNodeHeartbeatCache.CURRENT_NODE_STATISTICS));

    // Init DataNodeHeartbeatCache
    registeredDataNodes.forEach(
        dataNodeConfiguration -> {
          int dataNodeId = dataNodeConfiguration.getLocation().getDataNodeId();
          createNodeHeartbeatCache(NodeType.DataNode, dataNodeId);
        });

    // Init AiNodeHeartbeatCache
    registeredAINodes.forEach(
        aiNodeConfiguration -> {
          int aiNodeId = aiNodeConfiguration.getLocation().getAiNodeId();
          createNodeHeartbeatCache(NodeType.AINode, aiNodeId);
        });
  }
Initialize the nodeCacheMap when the ConfigNode-Leader is switched.
iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/load/cache/LoadCache.java