allthingssecurity commented on code in PR #27031:
URL: https://github.com/apache/camel/pull/27031#discussion_r4142386271
##########
components/camel-sjms/src/main/java/org/apache/camel/component/sjms/SjmsProducer.java:
##########
@@ -292,6 +292,9 @@ protected boolean processInOut(final Exchange exchange,
final AsyncCallback call
in.setHeader(SjmsConstants.JMS_CORRELATION_ID,
GENERATED_CORRELATION_ID_PREFIX + getUuidGenerator().generateUuid());
}
+ // the correlation id the reply handler is registered under, which is
cancelled if the send fails
+ final String[] registeredCorrelationId = new String[1];
Review Comment:
The value is assigned inside the anonymous
`MessageCreator.createMessage(...)` (`registeredCorrelationId[0] =
replyManager.registerReply(...)`) and read afterwards in the `catch` of
`processInOut`. A local captured by an anonymous class must be effectively
final, so a plain `String` can't be reassigned from inside it; the one-element
array is the holder for that. `createMessage` runs synchronously on the calling
thread within `doSend`, so no `AtomicReference` is needed for visibility (the
camel-jms fix in #26996 uses the same pattern).
If you prefer it more explicit, I can switch it to an
`AtomicReference<String>` or make the `MessageCreator` a small named class with
a field — just say which.
_Claude Code on behalf of allthingssecurity_
--
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]