gnodet-bot commented on code in PR #30911:
URL: https://github.com/apache/camel/pull/30911#discussion_r4716768749


##########
components/camel-jms/src/main/java/org/apache/camel/component/jms/reply/TemporaryQueueReplyManager.java:
##########
@@ -442,8 +448,11 @@ public Destination resolveDestinationName(Session session, 
String destinationNam
         }
 
         public void scheduleRefresh() {
-            refreshGeneration.incrementAndGet();
+            // clear replyTo before the new generation is visible: a consumer 
that resolves this generation publishes
+            // its queue after this write, so the late null cannot overwrite 
the new queue (no refresh would be pending
+            // any more, and replyTo would stay null until the next connection 
failure)
             replyTo = null;

Review Comment:
   🔍 **Comment describes the old bug, not the new invariant.** The 
parenthetical explains what broke before the fix rather than what the 
reordering guarantees. Consider:
   
   ```suggestion
               // Clear replyTo before making the new generation visible so 
that a consumer thread
               // that resolves and publishes the new queue cannot have its 
write overwritten by this null.
   ```



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to