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


##########
components/camel-file/src/main/java/org/apache/camel/component/file/FileConsumer.java:
##########
@@ -201,6 +223,9 @@ private ResumeAdapter setupResumeStrategy(GenericFile<File> 
gf) {
     protected boolean pollDirectory(Exchange dynamic, String fileName, 
List<GenericFile<File>> fileList, int depth) {
         LOG.trace("pollDirectory from fileName: {}", fileName);
 
+        // resolved again on the first check of this poll, as the starting 
directory can be replaced between polls
+        resolvedStartingDirectory = null;

Review Comment:
   💡 **Nit — comment accuracy:** The comment says *"resolved again on the first 
check of this poll"* but `resolvedStartingDirectory` is nulled here at the top 
of every `pollDirectory` call, before any file checks happen. With 
`concurrentConsumers > 1`, two threads can enter this method concurrently and 
both null the field — which is harmless (it just means two threads may each 
independently resolve and cache the path), but the comment's phrasing suggests 
this is the *first file check*, not the *start of a new poll cycle*. Consider:
   
   ```suggestion
           // reset per-poll cache so the starting directory is re-resolved on 
the first file check;
           // with concurrentConsumers > 1, multiple threads may reset and 
re-resolve concurrently (harmless)
           resolvedStartingDirectory = 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