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 2020/06/09 15:48:17 UTC

[GitHub] [rocketmq] xiangwangcheng commented on a change in pull request #1916: [ISSUE #1917]Specify executor to run CompletionStage

xiangwangcheng commented on a change in pull request #1916:
URL: https://github.com/apache/rocketmq/pull/1916#discussion_r437091949



##########
File path: broker/src/main/java/org/apache/rocketmq/broker/processor/SendMessageProcessor.java
##########
@@ -79,7 +79,7 @@ public RemotingCommand processRequest(ChannelHandlerContext ctx,
 
     @Override
     public void asyncProcessRequest(ChannelHandlerContext ctx, RemotingCommand request, RemotingResponseCallback responseCallback) throws Exception {
-        asyncProcessRequest(ctx, request).thenAcceptAsync(responseCallback::callback, this.brokerController.getSendMessageExecutor());
+        asyncProcessRequest(ctx, request).thenAccept(responseCallback::callback);

Review comment:
       OK, I think `thenAccept` and `thenAcceptAsync` are both OK, no big difference. The only difference between  `thenAccept` and `thenAcceptAsync` is the task in `thenAcceptAsync` is always executed in a different thread from a thread pool, while the task in `thenAccept` may be executed in the main thread, depending on some circumstances.




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