in src/main/java/com/googlesource/gerrit/plugins/events/fsstore/FsTransaction.java [133:149]
public static boolean renameAndDeleteEntriesOlderThan(
Path dir, Path del, FileTime expiry, int max) throws IOException {
try (DirectoryStream<Path> dirEntries = Files.newDirectoryStream(dir)) {
for (Path path : dirEntries) {
if (expiry.compareTo(Files.getLastModifiedTime(path)) > 0) {
if (max-- < 1) {
return false;
}
renameAndDelete(path, del);
}
}
} catch (DirectoryIteratorException e) {
// dir was deleted by another actor, thus so were all its entries
Nfs.throwIfNotStaleFileHandle(e.getCause());
}
return true;
}