fix journal purging

This commit is contained in:
Jörg Prante 2023-10-06 16:24:51 +02:00
parent acdbd0c028
commit 3f8520ed95

View file

@ -109,6 +109,7 @@ public class Journal {
writeLock.lock();
PathMatcher pathMatcher = journalPath.getFileSystem().getPathMatcher("glob:*.request");
try {
if (Files.exists(journalPath.resolve("success"))) {
Files.walkFileTree(journalPath.resolve("success"), EnumSet.of(FileVisitOption.FOLLOW_LINKS), Integer.MAX_VALUE, new SimpleFileVisitor<>() {
@Override
public FileVisitResult visitFile(Path p, BasicFileAttributes a) throws IOException {
@ -120,6 +121,7 @@ public class Journal {
return FileVisitResult.CONTINUE;
}
});
}
} finally {
writeLock.unlock();
}
@ -130,6 +132,7 @@ public class Journal {
writeLock.lock();
PathMatcher pathMatcher = journalPath.getFileSystem().getPathMatcher("glob:*.request");
try {
if (Files.exists(journalPath.resolve("fail"))) {
Files.walkFileTree(journalPath.resolve("fail"), EnumSet.of(FileVisitOption.FOLLOW_LINKS), Integer.MAX_VALUE, new SimpleFileVisitor<>() {
@Override
public FileVisitResult visitFile(Path p, BasicFileAttributes a) throws IOException {
@ -141,6 +144,7 @@ public class Journal {
return FileVisitResult.CONTINUE;
}
});
}
} finally {
writeLock.unlock();
}