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


##########
components/camel-avro-rpc/camel-avro-rpc-component/src/main/java/org/apache/camel/component/avro/AvroListener.java:
##########
@@ -50,9 +51,50 @@ public class AvroListener {
     private final ConcurrentMap<String, AvroConsumer> consumerRegistry = new 
ConcurrentHashMap<>();
     private AvroConsumer defaultConsumer;
     private final Server server;

Review Comment:
   🔍 **Pre-existing observation (not introduced by this PR, not blocking):** 
`defaultConsumer` is not `volatile`, yet `respond()` reads it on Avro server 
threads without synchronization. `consumerRegistry` (ConcurrentHashMap) has 
proper visibility, but `defaultConsumer` relies on the caller happening to see 
the write. In practice the first consumer registers before any request arrives 
(server starts in the constructor, consumer registers right after), so the 
window is negligible. Making it `volatile` would close the theoretical gap 
cleanly.
   
   ```suggestion
       private volatile AvroConsumer defaultConsumer;
   ```



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