public CompletableFuture<Long> appendEntries() {
    raft.checkThread();

    // If there are no other active members in the cluster, simply complete the append operation.
    if (raft.getCluster().getRemoteMemberStates().isEmpty()) {
      return CompletableFuture.completedFuture(null);
    }

    // Create a heartbeat future and add it to the heartbeat futures list.
    TimestampedFuture<Long> future = new TimestampedFuture<>();
    heartbeatFutures.add(future);

    // Iterate through members and append entries. Futures will be completed on responses from followers.
    for (RaftMemberContext member : raft.getCluster().getRemoteMemberStates()) {
      appendEntries(member);
    }
    return future;
  }
public CompletableFuture < Long > appendEntries ( ) { raft . checkThread ( ) ; if ( raft . getCluster ( ) . getRemoteMemberStates ( ) . isEmpty ( ) ) { return CompletableFuture . completedFuture ( null ) ; } TimestampedFuture < Long > future = new TimestampedFuture < > ( ) ; heartbeatFutures . add ( future ) ; for ( RaftMemberContext member : raft . getCluster ( ) . getRemoteMemberStates ( ) ) { appendEntries ( member ) ; } return future ; }
Triggers a heartbeat to a majority of the cluster.
<p>
For followers to which no AppendRequest is currently being sent, a new empty AppendRequest will be
created and sent. For followers to which an AppendRequest is already being sent, the appendEntries()
call will piggyback on the *next* AppendRequest. Thus, multiple calls to this method will only ever
result in a single AppendRequest to each follower at any given time, and the returned future will be
shared by all concurrent calls.

@return A completable future to be completed the next time a heartbeat is received by a majority of the cluster.