szetszwo commented on code in PR #738:
URL: https://github.com/apache/ratis/pull/738#discussion_r1326308560


##########
ratis-grpc/src/main/java/org/apache/ratis/grpc/server/GrpcServerProtocolService.java:
##########
@@ -197,6 +197,20 @@ public void 
startLeaderElection(StartLeaderElectionRequestProto request,
     }
   }
 
+  @Override
+  public void readIndex(ReadIndexRequestProto request, 
StreamObserver<ReadIndexReplyProto> responseObserver) {
+    try {
+      server.readIndexAsync(request).thenAccept(reply -> {

Review Comment:
   Good point!  We probably should use `whenComplete` to call `onError`.
   ```java
         server.readIndexAsync(request).whenComplete((reply, e) -> {
           if (reply != null) {
             responseObserver.onNext(reply);
             responseObserver.onCompleted();
           } else {
             if (e == null) {
               e = new IOException("Failed to get readIndex: request=" + 
request);
             }
             responseObserver.onError(GrpcUtil.wrapException(e));
           }
         });
   ```



-- 
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]

Reply via email to