public void cacheHeartbeatSample(AbstractHeartbeatSample newHeartbeatSample) {
    synchronized (slidingWindow) {
      // Only sequential heartbeats are accepted.
      // And un-sequential heartbeats will be discarded.
      if (getLastSample() == null
          || getLastSample().getSampleLogicalTimestamp()
              <= newHeartbeatSample.getSampleLogicalTimestamp()) {
        slidingWindow.add(newHeartbeatSample);
      }

      if (slidingWindow.size() > MAXIMUM_WINDOW_SIZE) {
        slidingWindow.remove(0);
      }
    }
  }
Cache the latest heartbeat sample.

@param newHeartbeatSample The latest heartbeat sample.
iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/load/cache/AbstractLoadCache.java