orpiske commented on a change in pull request #6228: URL: https://github.com/apache/camel/pull/6228#discussion_r724885633
########## File path: components/camel-file/src/main/java/org/apache/camel/component/file/FileConsumer.java ########## @@ -177,6 +150,56 @@ protected boolean pollDirectory(String fileName, List<GenericFile<File>> fileLis return true; } + private List<File> listFiles(File directory) { + final File[] dirFiles = directory.listFiles(); + + if (dirFiles == null || dirFiles.length == 0) { + // no files in this directory to poll + if (LOG.isTraceEnabled()) { + LOG.trace("No files found in directory: {}", directory.getPath()); + } + return Collections.emptyList(); + } else { + // we found some files + if (LOG.isTraceEnabled()) { + LOG.trace("Found {} in directory: {}", dirFiles.length, directory.getPath()); + } + } + + FileResumeInfo resumeInfo = new FileResumeInfo(Arrays.asList(dirFiles)); Review comment: Thanks Claus. I think we can go with with the File array. I was leaving the optimizations for later, but it makes sense not to pessimize it in the first place. I will adjust it. -- 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: commits-unsubscr...@camel.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org