ChunkParser should not log filtered events JEP-349-branch
authoregahlin
Wed, 23 Oct 2019 23:19:27 +0200
branchJEP-349-branch
changeset 58767 94d3a7bc8561
parent 58765 1256af493619
child 58768 08fef29ad1cf
ChunkParser should not log filtered events
src/jdk.jfr/share/classes/jdk/jfr/internal/consumer/ChunkParser.java
--- a/src/jdk.jfr/share/classes/jdk/jfr/internal/consumer/ChunkParser.java	Wed Oct 23 20:11:21 2019 +0200
+++ b/src/jdk.jfr/share/classes/jdk/jfr/internal/consumer/ChunkParser.java	Wed Oct 23 23:19:27 2019 +0200
@@ -241,23 +241,25 @@
                 throw new IOException("Event can't have zero size");
             }
             long typeId = input.readLong();
-
-            if (typeId != 0) { // Not metadata event
-                Parser p = parsers.get(typeId);
-                if (p instanceof EventParser) {
-                    EventParser ep = (EventParser) p;
-                    RecordedEvent event = ep.parse(input);
-                    if (event != null) {
-                        input.position(pos + size);
-                        return event;
-                    }
+            Parser p = parsers.get(typeId);
+            if (p instanceof EventParser) {
+                // Fast path
+                EventParser ep = (EventParser) p;
+                RecordedEvent event = ep.parse(input);
+                if (event != null) {
+                    input.position(pos + size);
+                    return event;
                 }
+                // Not accepted by filter
+            } else {
                 if (typeId == 1) { // checkpoint event
                     if (flushOperation != null) {
                         parseCheckpoint();
                     }
                 } else {
-                    Logger.log(LogTag.JFR_SYSTEM_PARSER, LogLevel.INFO, "Unknwon event type " + typeId);
+                    if (typeId != 0) { // Not metadata event
+                        Logger.log(LogTag.JFR_SYSTEM_PARSER, LogLevel.INFO, "Unknwon event type " + typeId);
+                    }
                 }
             }
             input.position(pos + size);