private void checkDirectory() {
try {
try (Stream<Path> files = Files.list(directory)) {
files.forEach(path -> {
if (!uniquePathsSubmitted.add(path) && !pendingSubmittedPaths.contains(path)) {
baseLogger().warn("There has been an attempt to add \"{}\" after it has already been added.", path);
FileUtils.delete(path);
return;
}
pendingSubmittedPaths.add(path);
CompletableFuture.runAsync(() -> handleException(() -> baseConsumer.accept(path)), execu…