You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ratis.apache.org by GitBox <gi...@apache.org> on 2020/11/16 06:48:32 UTC

[GitHub] [incubator-ratis] amaliujia commented on a change in pull request #278: RATIS-1153. Implement ChannelInboundHandler.exceptionCaught in NettyServerStreamRpc

amaliujia commented on a change in pull request #278:
URL: https://github.com/apache/incubator-ratis/pull/278#discussion_r523926434



##########
File path: ratis-netty/src/main/java/org/apache/ratis/netty/server/DataStreamManagement.java
##########
@@ -331,7 +333,24 @@ static void replyDataStreamException(RaftServer server, Throwable cause, RaftCli
       DataStreamRequestByteBuf request, ChannelHandlerContext ctx) {
     DataStreamException dataStreamException = new DataStreamException(server.getId(), cause);
     RaftClientReply reply = new RaftClientReply(raftClientRequest, dataStreamException, null);
-    ctx.writeAndFlush(newDataStreamReplyByteBuffer(request, reply));
+    sendDataStreamException(cause, request, reply, ctx);
+  }
+
+  void replyDataStreamException(Throwable cause, DataStreamRequestByteBuf request, ChannelHandlerContext ctx) {
+    DataStreamException dataStreamException = new DataStreamException(server.getId(), cause);
+    RaftClientReply reply = new RaftClientReply(ClientId.emptyClientId(), server.getId(), RaftGroupId.emptyGroupId(),
+        -1, false, null, dataStreamException, 0L, null);
+    sendDataStreamException(cause, request, reply, ctx);
+  }
+
+  static void sendDataStreamException(Throwable throwable, DataStreamRequestByteBuf request, RaftClientReply reply,
+      ChannelHandlerContext ctx) {
+    LOG.warn("Failed to process {}",  request, throwable);

Review comment:
       `LOG.warn("Failed to process {} because of {}",  request, throwable);`?




----------------------------------------------------------------
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:
users@infra.apache.org