--- a/src/jdk.jfr/share/classes/jdk/jfr/internal/consumer/RepositoryFiles.java Thu Oct 24 07:02:36 2019 +0200
+++ b/src/jdk.jfr/share/classes/jdk/jfr/internal/consumer/RepositoryFiles.java Sat Oct 26 23:59:51 2019 +0200
@@ -109,6 +109,24 @@
}
Path nextPath(long startTimeNanos) {
+ if (closed) {
+ return null;
+ }
+ // Try to get the 'exact' path first
+ // to avoid skipping files if repository
+ // is updated while DirectoryStream
+ // is traversing it
+ Path path = pathSet.get(startTimeNanos);
+ if (path != null) {
+ return path;
+ }
+ // Update paths
+ try {
+ updatePaths();
+ } catch (IOException e) {
+ // ignore
+ }
+ // try to get the next file
return path(startTimeNanos);
}