src/jdk.jfr/share/classes/jdk/jfr/internal/consumer/RepositoryFiles.java
branchJEP-349-branch
changeset 57604 838f9a7635b6
parent 57449 099789ceff7d
child 57628 f5f590eaecf5
--- a/src/jdk.jfr/share/classes/jdk/jfr/internal/consumer/RepositoryFiles.java	Fri Jul 12 15:04:28 2019 +0200
+++ b/src/jdk.jfr/share/classes/jdk/jfr/internal/consumer/RepositoryFiles.java	Wed Jul 31 14:07:44 2019 +0200
@@ -66,7 +66,7 @@
     public Path nextPath(long startTimeNanos) {
         while (!closed) {
             if (startTimeNanos == -1) {
-                Entry<Long, Path> e =  pathSet.lastEntry();
+                Entry<Long, Path> e = pathSet.lastEntry();
                 if (e != null) {
                     return e.getValue();
                 }
@@ -106,17 +106,16 @@
         boolean foundNew = false;
         List<Path> added = new ArrayList<>();
         Set<Path> current = new HashSet<>();
-        if (!Files.exists(repo)) {
-            // Repository removed, probably due to shutdown
-            return true;
-        }
-        try (DirectoryStream<Path> dirStream = Files.newDirectoryStream(repo, "*.jfr")) {
+        try (DirectoryStream<Path> dirStream = Files.newDirectoryStream(repo)) {
             for (Path p : dirStream) {
                 if (!pathLookup.containsKey(p)) {
-                    added.add(p);
-                    Logger.log(LogTag.JFR_SYSTEM_STREAMING, LogLevel.DEBUG, "New file found: " + p.toAbsolutePath());
+                    String s = p.toString();
+                    if (s.endsWith(".jfr")) {
+                        added.add(p);
+                        Logger.log(LogTag.JFR_SYSTEM_STREAMING, LogLevel.DEBUG, "New file found: " + p.toAbsolutePath());
+                    }
+                    current.add(p);
                 }
-                current.add(p);
             }
         }
         List<Path> removed = new ArrayList<>();
@@ -160,5 +159,4 @@
         }
     }
 
-
 }
\ No newline at end of file