Search in sources :

Example 1 with RequestVoteRequestProto

use of org.apache.ratis.proto.RaftProtos.RequestVoteRequestProto in project incubator-ratis by apache.

the class LeaderElection method submitRequests.

private int submitRequests(Phase phase, long electionTerm, TermIndex lastEntry, Collection<RaftPeer> others, Executor voteExecutor) {
    int submitted = 0;
    for (final RaftPeer peer : others) {
        final RequestVoteRequestProto r = ServerProtoUtils.toRequestVoteRequestProto(server.getMemberId(), peer.getId(), electionTerm, lastEntry, phase == Phase.PRE_VOTE);
        voteExecutor.submit(() -> server.getServerRpc().requestVote(r));
        submitted++;
    }
    return submitted;
}
Also used : RequestVoteRequestProto(org.apache.ratis.proto.RaftProtos.RequestVoteRequestProto) RaftPeer(org.apache.ratis.protocol.RaftPeer)

Aggregations

RequestVoteRequestProto (org.apache.ratis.proto.RaftProtos.RequestVoteRequestProto)1 RaftPeer (org.apache.ratis.protocol.RaftPeer)1