Search in sources :

Example 1 with VoteRequest

use of com.hazelcast.cp.internal.raft.impl.dto.VoteRequest in project hazelcast by hazelcast.

the class LeaderElectionTask method innerRun.

@Override
protected void innerRun() {
    RaftState state = raftNode.state();
    if (state.leader() != null) {
        logger.warning("No new election round, we already have a LEADER: " + state.leader());
        return;
    }
    VoteRequest request = state.toCandidate(disruptive);
    logger.info("Leader election started for term: " + request.term() + ", last log index: " + request.lastLogIndex() + ", last log term: " + request.lastLogTerm());
    raftNode.printMemberState();
    for (RaftEndpoint endpoint : state.remoteMembers()) {
        raftNode.send(request, endpoint);
    }
    scheduleLeaderElectionTimeout();
}
Also used : RaftState(com.hazelcast.cp.internal.raft.impl.state.RaftState) RaftEndpoint(com.hazelcast.cp.internal.raft.impl.RaftEndpoint) VoteRequest(com.hazelcast.cp.internal.raft.impl.dto.VoteRequest)

Aggregations

RaftEndpoint (com.hazelcast.cp.internal.raft.impl.RaftEndpoint)1 VoteRequest (com.hazelcast.cp.internal.raft.impl.dto.VoteRequest)1 RaftState (com.hazelcast.cp.internal.raft.impl.state.RaftState)1