amaliujia commented on a change in pull request #213:
URL: https://github.com/apache/incubator-ratis/pull/213#discussion_r507949667
##########
File path:
ratis-netty/src/main/java/org/apache/ratis/netty/server/NettyServerStreamRpc.java
##########
@@ -115,10 +128,29 @@ private ChannelInboundHandler getServerHandler(){
public void channelRead(ChannelHandlerContext ctx, Object msg) {
final DataStreamRequestByteBuf request = (DataStreamRequestByteBuf)msg;
final ByteBuf buf = request.slice();
- final AtomicBoolean released = new AtomicBoolean();
- streams.computeIfAbsent(request.getStreamId(), id ->
getDataStreamFuture(buf, released))
- .thenApply(stream -> writeTo(buf, stream, released.get()))
- .thenAccept(byteWritten -> sendReply(request, byteWritten, ctx));
+ final boolean isHeader = request.getStreamOffset() == -1;
+
+ CompletableFuture<?>[] parallelWrites = new
CompletableFuture<?>[clients.size() + 1];
Review comment:
Not doing this for two reasons
1. this is a case that peers size is known and small, so use an fixed size
array fits here.
2. Java will interpret the result of that list to array as `Object` (so not
`CompletableFuture<?>`), then I need to do a manual cast from Object to
CompletableFuture, which is not compile time type safe.
----------------------------------------------------------------
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]