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


##########
components/camel-elasticsearch/src/main/java/org/apache/camel/component/es/ElasticsearchScrollRequestIterator.java:
##########
@@ -42,6 +47,7 @@ public class ElasticsearchScrollRequestIterator<TDocument> 
implements Iterator<H
     private String scrollId;
     private boolean closed;
     private int requestCount;
+    private Closeable resource;

Review Comment:
   ⚠️ **Concurrency gap (re-raising from prior review — still not addressed):** 
`closeOnClose()` writes this field from the producer thread; `close()` and 
`closeAtEnd()` read it from the consumer thread. Without `volatile`, the JMM 
provides no happens-before guarantee — the reader may see `null` and silently 
skip releasing the client.
   
   ```suggestion
       private volatile Closeable resource;
   ```



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