Class ELECTION2

java.lang.Object
org.jgroups.stack.Protocol
org.jgroups.protocols.raft.election.BaseElection
org.jgroups.protocols.raft.ELECTION2
All Implemented Interfaces:
org.jgroups.Lifecycle

public class ELECTION2 extends BaseElection
A leader election protocol.

This implementation extends ELECTION with a pre-vote mechanism. The pre-vote always runs before starting the voting thread to define the leader. The pre-vote increases the delay in electing the leader but, in turn, covers more edge cases. As a rule of thumb, if deploying in an unstable network with frequent partitions, this protocol should give a more stable mechanism, avoid leader disruptions, and avoid possible liveness issues. Otherwise, ELECTION is the default choice.

Pre-Voting phase:

This extension includes the pre-voting mechanism proposed in Ongaro's dissertation (§9.6). In the current implementation, a pre-voting phase starts in case the current node is the new view coordinator and: The process which executes the pre-voting mechanism sends a PreVoteRequest to all processes in the view. The recipients reply with a PreVoteResponse identifying the node they see as leader. Once the initiator receives the reply from all nodes in the view, it can start the voting process, resuming the work the same as ELECTION.
Since:
1.0.12
Author:
José Bolina
See Also:
  • Field Details

  • Constructor Details

    • ELECTION2

      public ELECTION2()
  • Method Details

    • isPreVoteThreadRunning

      public boolean isPreVoteThreadRunning()
    • handleView

      protected void handleView(org.jgroups.View v)
      Specified by:
      handleView in class BaseElection
    • handleMessage

      protected void handleMessage(org.jgroups.Message msg, RaftHeader hdr)
      Overrides:
      handleMessage in class BaseElection