lokeshj1703 commented on a change in pull request #65:
URL: https://github.com/apache/incubator-ratis/pull/65#discussion_r415703916
##########
File path:
ratis-server/src/main/java/org/apache/ratis/server/impl/RaftServerImpl.java
##########
@@ -460,6 +460,20 @@ public String toString() {
return null;
}
+ @VisibleForTesting
+ public boolean isLeaderReady() {
+ if (!isLeader()) {
+ return false;
+ }
+
+ final LeaderState leaderState = role.getLeaderState().orElse(null);
+ if (leaderState == null || !leaderState.isReady()) {
+ return false;
+ }
+
+ return true;
Review comment:
We can simplify this as.
`return leaderState != null && leaderState.isReady();`
##########
File path:
ratis-server/src/main/java/org/apache/ratis/server/impl/RaftServerImpl.java
##########
@@ -460,6 +460,20 @@ public String toString() {
return null;
}
+ @VisibleForTesting
+ public boolean isLeaderReady() {
+ if (!isLeader()) {
Review comment:
We can remove this check as leaderState == null covers the case and use
this function in checkLeaderState line 451 as well.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]