runzhiwang commented on a change in pull request #230:
URL: https://github.com/apache/incubator-ratis/pull/230#discussion_r509914757



##########
File path: 
ratis-netty/src/main/java/org/apache/ratis/netty/server/NettyServerStreamRpc.java
##########
@@ -199,25 +207,45 @@ public void channelRead(ChannelHandlerContext ctx, Object 
msg) throws IOExceptio
           // do not need to forward header request
           final List<DataStreamOutput> outs = proxies.getDataStreamOutput();
           peersStreamOutput.put(request.getStreamId(), outs);
-          for(DataStreamOutput out : outs) {
+          for (DataStreamOutput out : outs) {
             remoteWrites.add(out.getHeaderFuture());
           }
         } else {
           // body
-          for(DataStreamOutput out : 
peersStreamOutput.get(request.getStreamId())) {
+          for (DataStreamOutput out : 
peersStreamOutput.get(request.getStreamId())) {
             remoteWrites.add(out.writeAsync(request.slice().nioBuffer()));
           }
         }
 
         JavaUtils.allOf(remoteWrites).thenCombine(localWrite, (v, 
bytesWritten) -> {
               buf.release();
-              sendReply(request, bytesWritten, ctx);

Review comment:
       
    
   
    
   You can move the following code into sendReply, and rename the origin 
sendReply to sendReplySuccess.
    
   ```
    try {
                   if (!checkSuccessRemoteWrite(remoteWrites, bytesWritten)) {
                     sendReplyNotSuccess(request, ctx);
                   } else {
                     sendReply(request, bytesWritten, ctx);
                   }
                 } catch (ExecutionException | InterruptedException e) {
                   IOUtils.asIOException(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.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to