Package io.atomix.raft.protocol
Class PollRequest.Builder
java.lang.Object
io.atomix.raft.protocol.AbstractRaftRequest.Builder<PollRequest.Builder,PollRequest>
io.atomix.raft.protocol.PollRequest.Builder
- All Implemented Interfaces:
RaftRequest.Builder<PollRequest.Builder,,PollRequest> Builder<PollRequest>
- Enclosing class:
PollRequest
public static class PollRequest.Builder
extends AbstractRaftRequest.Builder<PollRequest.Builder,PollRequest>
Poll request builder.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()protected voidvalidate()Validates the builder.withCandidate(MemberId candidate) Sets the request leader.withLastLogIndex(long logIndex) Sets the request last log index.withLastLogTerm(long logTerm) Sets the request last log term.withTerm(long term) Sets the request term.Methods inherited from class io.atomix.raft.protocol.AbstractRaftRequest.Builder
toString
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
withTerm
Sets the request term.- Parameters:
term- The request term.- Returns:
- The poll request builder.
- Throws:
IllegalArgumentException- iftermis negative
-
withCandidate
Sets the request leader.- Parameters:
candidate- The request candidate.- Returns:
- The poll request builder.
- Throws:
IllegalArgumentException- ifcandidateis not positive
-
withLastLogIndex
Sets the request last log index.- Parameters:
logIndex- The request last log index.- Returns:
- The poll request builder.
- Throws:
IllegalArgumentException- ifindexis negative
-
withLastLogTerm
Sets the request last log term.- Parameters:
logTerm- The request last log term.- Returns:
- The poll request builder.
- Throws:
IllegalArgumentException- iftermis negative
-
build
- Throws:
IllegalStateException- if candidate is not positive or if term, lastLogIndex or lastLogTerm are negative
-
validate
protected void validate()Description copied from class:AbstractRaftRequest.BuilderValidates the builder.- Overrides:
validatein classAbstractRaftRequest.Builder<PollRequest.Builder,PollRequest>
-