You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@rocketmq.apache.org by GitBox <gi...@apache.org> on 2022/06/13 02:19:31 UTC

[GitHub] [rocketmq] lizhanhui commented on a diff in pull request #4446: Revamp interceptor filter of RemotingCommand

lizhanhui commented on code in PR #4446:
URL: https://github.com/apache/rocketmq/pull/4446#discussion_r895280924


##########
remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingAbstract.java:
##########
@@ -166,22 +178,55 @@ public void processMessageReceived(ChannelHandlerContext ctx, RemotingCommand ms
         }
     }
 
+    protected Decision preHandle(final HandlerContext context, final RemotingCommand request,
+                                 final CompletableFuture<RemotingCommand> responseFuture) {
+        Decision decision = Decision.CONTINUE;
+        for (Handler handler : handlers) {
+            try {
+                decision = handler.preHandle(context, request, responseFuture);
+            } catch (Throwable ignore) {

Review Comment:
   After a second thought, let's change the decision to stop and generate response command according to the exception raised.



##########
remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingAbstract.java:
##########
@@ -166,22 +178,55 @@ public void processMessageReceived(ChannelHandlerContext ctx, RemotingCommand ms
         }
     }
 
+    protected Decision preHandle(final HandlerContext context, final RemotingCommand request,
+                                 final CompletableFuture<RemotingCommand> responseFuture) {
+        Decision decision = Decision.CONTINUE;
+        for (Handler handler : handlers) {
+            try {
+                decision = handler.preHandle(context, request, responseFuture);
+            } catch (Throwable ignore) {

Review Comment:
   After a second thought, let's change the decision to stop and generate a response command according to the exception raised.



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

To unsubscribe, e-mail: dev-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org