code: private void completeHeartbeat() {
      heartbeatFailures = 0;
      heartbeatFuture = nextHeartbeatFuture;
      nextHeartbeatFuture = null;
      updateGlobalIndex();
      if (heartbeatFuture != null) {
        heartbeatTime = System.currentTimeMillis();
        for (MemberState member : context.getClusterState().getRemoteMemberStates()) {
          appendEntries(member);
        }
      }
    }
docs: Completes a heartbeat by replacing the current heartbeatFuture with the nextHeartbeatFuture, updating the
  current heartbeatTime, and starting a new {@link AppendRequest} to all active members.