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



##########
File path: 
ratis-netty/src/main/java/org/apache/ratis/netty/server/NettyServerStreamRpc.java
##########
@@ -58,51 +63,55 @@
 
   private final StateMachine stateMachine;
   private final ConcurrentMap<Long, CompletableFuture<DataStream>> streams = 
new ConcurrentHashMap<>();
+  private final ConcurrentMap<Long, List<DataStreamOutput>> peersStreamOutput 
= new ConcurrentHashMap<>();
+
+  private List<DataStreamClient> clients = new ArrayList<>();
 
   public NettyServerStreamRpc(RaftPeer server, StateMachine stateMachine) {
     this.raftServer = server;
     this.stateMachine = stateMachine;
     this.channelFuture = buildChannel();
   }
 
-  private CompletableFuture<DataStream> getDataStreamFuture(ByteBuf buf, 
AtomicBoolean released) {
+  public NettyServerStreamRpc(
+      RaftPeer server, List<RaftPeer> otherPeers,
+      StateMachine stateMachine, RaftProperties properties){
+    this(server, stateMachine);
+    setupClient(otherPeers, properties);
+  }
+
+  private List<DataStreamOutput> getDataStreamOutput() {
+    return clients.stream().map(client -> 
client.stream()).collect(Collectors.toList());

Review comment:
       @szetszwo @amaliujia Should we use the streamId got from client to 
current server ? Maybe it's easy to debug when error happens. Not sure when the 
streamId will be different among 3 servers, but if the streamId is different, 
the same stream has different streamId among 3 servers seems confused.
   
   ```
   private List<DataStreamOutput> getDataStreamOutput(long streamId) {
       return clients.stream().map(client -> 
client.stream(streamId)).collect(Collectors.toList());
   }
   ```




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