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



##########
File path: 
ratis-client/src/main/java/org/apache/ratis/client/impl/DataStreamClientImpl.java
##########
@@ -22,25 +22,39 @@
 import org.apache.ratis.client.DataStreamOutputRpc;
 import org.apache.ratis.conf.RaftProperties;
 import org.apache.ratis.datastream.impl.DataStreamPacketByteBuffer;
+import org.apache.ratis.datastream.impl.DataStreamReplyByteBuffer;
 import org.apache.ratis.proto.RaftProtos.DataStreamPacketHeaderProto.Type;
 import org.apache.ratis.protocol.ClientId;
+import org.apache.ratis.protocol.ClientInvocationId;
 import org.apache.ratis.protocol.DataStreamReply;
+import org.apache.ratis.protocol.RaftClientReply;
 import org.apache.ratis.protocol.RaftClientRequest;
 import org.apache.ratis.protocol.RaftGroupId;
 import org.apache.ratis.protocol.RaftPeer;
 import org.apache.ratis.protocol.exceptions.AlreadyClosedException;
+import org.apache.ratis.util.IOUtils;
 import org.apache.ratis.util.JavaUtils;
 import org.apache.ratis.util.MemoizedSupplier;
 
 import java.io.IOException;
 import java.nio.ByteBuffer;
+import java.nio.channels.WritableByteChannel;
 import java.util.concurrent.CompletableFuture;
 
 /**
  * Streaming client implementation
  * allows client to create streams and send asynchronously.
  */
 public class DataStreamClientImpl implements DataStreamClient {
+  private static RaftClientReply getRaftClientReply(DataStreamReply reply) {

Review comment:
       Duplicate with the following code.
   ```
   static RaftClientReply getRaftClientReply(DataStreamReply dataStreamReply) {
       if (dataStreamReply instanceof DataStreamReplyByteBuffer) {
         try {
           return 
ClientProtoUtils.toRaftClientReply(((DataStreamReplyByteBuffer) 
dataStreamReply).slice());
         } catch (InvalidProtocolBufferException e) {
           throw new IllegalStateException("Failed to parse " + 
JavaUtils.getClassSimpleName(dataStreamReply.getClass())
               + ": reply is " + dataStreamReply, e);
         }
       } else {
         throw new IllegalStateException("Unexpected " + 
dataStreamReply.getClass() + ": reply is " + dataStreamReply);
       }
     }
   ```




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