Class PollResponse

All Implemented Interfaces:
RaftMessage, RaftResponse

public class PollResponse extends AbstractRaftResponse
Server poll response.

Poll responses are sent by active servers in response to poll requests by followers to indicate whether the responding server would vote for the requesting server if it were a candidate. This is indicated by the accepted() field of the response.

  • Constructor Details

  • Method Details

    • builder

      public static PollResponse.Builder builder()
      Returns a new poll response builder.
      Returns:
      A new poll response builder.
    • term

      public long term()
      Returns the responding node's current term.
      Returns:
      The responding node's current term.
    • accepted

      public boolean accepted()
      Returns a boolean indicating whether the poll was accepted.
      Returns:
      Indicates whether the poll was accepted.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class AbstractRaftResponse
    • equals

      public boolean equals(Object object)
      Overrides:
      equals in class AbstractRaftResponse
    • toString

      public String toString()
      Overrides:
      toString in class AbstractRaftResponse