133tosakarin commented on code in PR #1168:
URL: https://github.com/apache/ratis/pull/1168#discussion_r1802591289
##########
ratis-server/src/main/java/org/apache/ratis/server/impl/RaftServerImpl.java:
##########
@@ -1448,42 +1481,47 @@ private RequestVoteReplyProto requestVote(Phase phase,
getMemberId(), phase, candidateId, candidateGroupId, candidateTerm,
candidateLastEntry);
assertLifeCycleState(LifeCycle.States.RUNNING);
assertGroup(getMemberId(), candidateId, candidateGroupId);
+ Pair<RequestVoteReplyProto, CompletableFuture<Void>> replyAndFuture =
requestVoteImpl(phase, candidateId, candidateGroupId, candidateTerm,
candidateLastEntry);
+ replyAndFuture.second.join();
+ return replyAndFuture.first;
+ }
+ synchronized Pair<RequestVoteReplyProto, CompletableFuture<Void>>
requestVoteImpl(Phase phase,
Review Comment:
ok
##########
ratis-server/src/main/java/org/apache/ratis/server/impl/RaftServerImpl.java:
##########
@@ -565,16 +565,40 @@ void setFirstElection(Object reason) {
}
}
+ static class Pair<U, V> {
+ private final U first;
+ private final V second;
+
+ Pair(U metadataUpdated, V future) {
+ this.first = metadataUpdated;
+ this.second = future;
+ }
+
+ public static <U, V> Pair<U, V> makePair(U first, V second) {
+ return new Pair<>(first, second);
+ }
+
+ U first() {
+ return first;
+ }
+
+ V second() {
+ return second;
+ }
+
Review Comment:
ok
##########
ratis-server/src/main/java/org/apache/ratis/server/impl/FollowerState.java:
##########
@@ -98,6 +99,7 @@ boolean isCurrentLeaderValid() {
CompletableFuture<Void> stopRunning() {
this.isRunning = false;
interrupt();
+ stopped.complete(null);
Review Comment:
ok
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]