amaliujia commented on code in PR #1632:
URL: https://github.com/apache/ratis/pull/1632#discussion_r4237354461


##########
ratis-server/src/test/java/org/apache/ratis/RaftAsyncTests.java:
##########
@@ -380,22 +380,19 @@ void runTestWriteAsyncCustomReplicationLevel(CLUSTER 
cluster) throws Exception {
     try (RaftClient client = cluster.createClient(leader)) {
 
       // submit some messages
+      final List<CompletableFuture<RaftClientReply>> futures = new 
ArrayList<>();
       for (int i = 0; i < numMessages; i++) {
         final String s = "" + i;
         LOG.info("sendAsync with ALL_COMMITTED " + s);
-        client.async().send(new SimpleMessage(s), 
ReplicationLevel.ALL_COMMITTED).whenComplete((reply, exception) -> {
-          if (exception != null) {
-            LOG.error("Failed to send message " + s, exception);
-            // reply should be null in case of exception
-            Assertions.assertNull(reply);
-            return;
-          }
-          Assertions.assertTrue(reply.isSuccess());
-          Assertions.assertNull(reply.getException());
-          // verify that all servers have caught up to log index when the 
reply is returned
-          reply.getCommitInfos().forEach(commitInfoProto ->
-              Assertions.assertTrue(commitInfoProto.getCommitIndex() >= 
reply.getLogIndex()));
-        });
+        futures.add(client.async().send(new SimpleMessage(s), 
ReplicationLevel.ALL_COMMITTED));
+      }
+      for (CompletableFuture<RaftClientReply> f : futures) {
+        final RaftClientReply reply = getWithDefaultTimeout(f);

Review Comment:
   ```  
           if (exception != null) {
               LOG.error("Failed to send message " + s, exception);
               // reply should be null in case of exception
               Assertions.assertNull(reply);
               return;
             }
   ```
   
   This code has been dropped. Is it because the NPE is gone?



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