Skip to content

Commit

Permalink
restore comment
Browse files Browse the repository at this point in the history
  • Loading branch information
laurit committed Oct 23, 2022
1 parent 8d70ba3 commit 9d2cd8f
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ public void consumeMessageBefore(ConsumeMessageContext context) {
Context parentContext = Context.current();
Context newContext = instrumenter.start(parentContext, context.getMsgList());

// it's safe to store the scope in the rocketMq message context, both before() and after()
// methods are always called from the same thread; see:
// - ConsumeMessageConcurrentlyService$ConsumeRequest#run()
// - ConsumeMessageOrderlyService$ConsumeRequest#run()
if (newContext != parentContext) {
contextAndScopeField.set(
context, ContextAndScope.create(newContext, newContext.makeCurrent()));
Expand Down

0 comments on commit 9d2cd8f

Please sign in to comment.