public void cacheDataNodeHeartbeatSample(int nodeId, NodeHeartbeatSample sample) {
    // Only cache sample when the corresponding loadCache exists
    Optional.ofNullable(nodeCacheMap.get(nodeId))
        .ifPresent(node -> node.cacheHeartbeatSample(sample));
    Optional.ofNullable(heartbeatProcessingMap.get(nodeId)).ifPresent(node -> node.set(false));
  }
Cache the latest heartbeat sample of a DataNode.

@param nodeId the id of the DataNode
@param sample the latest heartbeat sample
iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/load/cache/LoadCache.java