protected void sendAppendRequest(RaftMemberContext member, AppendRequest request) {
    // If this is a heartbeat message and a heartbeat is already in progress, skip the request.
    if (request.entries().isEmpty() && !member.canHeartbeat()) {
      return;
    }

    // Start the append to the member.
    member.startAppend();

    long timestamp = System.currentTimeMillis();

    log.trace("Sending {} to {}", request, member.getMember().memberId());
    raft.getProtocol().append(member.getMember().memberId(), request).whenCompleteAsync((response, error) -> {
      // Complete the append to the member.
      if (!request.entries().isEmpty()) {
        member.completeAppend(System.currentTimeMillis() - timestamp);
      } else {
        member.completeAppend();
      }

      if (open) {
        if (error == null) {
          log.trace("Received {} from {}", response, member.getMember().memberId());
          handleAppendResponse(member, request, response, timestamp);
        } else {
          handleAppendResponseFailure(member, request, error);
        }
      }
    }, raft.getThreadContext());

    if (!request.entries().isEmpty() && hasMoreEntries(member)) {
      appendEntries(member);
    }
  }
protected void sendAppendRequest ( RaftMemberContext member , AppendRequest request ) { if ( request . entries ( ) . isEmpty ( ) && ! member . canHeartbeat ( ) ) { return ; } member . startAppend ( ) ; long timestamp = System . currentTimeMillis ( ) ; log . trace ( "Sending {} to {}" , request , member . getMember ( ) . memberId ( ) ) ; raft . getProtocol ( ) . append ( member . getMember ( ) . memberId ( ) , request ) . whenCompleteAsync ( ( response , error ) -> { if ( ! request . entries ( ) . isEmpty ( ) ) { member . completeAppend ( System . currentTimeMillis ( ) - timestamp ) ; } else { member . completeAppend ( ) ; } if ( open ) { if ( error == null ) { log . trace ( "Received {} from {}" , response , member . getMember ( ) . memberId ( ) ) ; handleAppendResponse ( member , request , response , timestamp ) ; } else { handleAppendResponseFailure ( member , request , error ) ; } } } , raft . getThreadContext ( ) ) ; if ( ! request . entries ( ) . isEmpty ( ) && hasMoreEntries ( member ) ) { appendEntries ( member ) ; } }
Connects to the member and sends a commit message.