--- a/src/jdk.jfr/share/classes/jdk/jfr/internal/consumer/ChunkParser.java Thu Nov 28 16:28:53 2019 +0100
+++ b/src/jdk.jfr/share/classes/jdk/jfr/internal/consumer/ChunkParser.java Thu Nov 28 16:38:25 2019 +0100
@@ -106,6 +106,7 @@
private Runnable flushOperation;
private ParserConfiguration configuration;
+ private volatile boolean closed;
public ChunkParser(RecordingInput input) throws IOException {
this(input, new ParserConfiguration());
@@ -284,6 +285,9 @@
Logger.log(LogTag.JFR_SYSTEM_PARSER, LogLevel.INFO, "Waiting for more data (streaming). Read so far: " + chunkHeader.getChunkSize() + " bytes");
}
while (true) {
+ if (closed) {
+ return true;
+ }
if (chunkHeader.getLastNanos() > filterEnd) {
return true;
}
@@ -455,4 +459,9 @@
return chunkHeader.isFinalChunk();
}
+ public void close() {
+ this.closed = true;
+ Utils.notifyFlush();
+ }
+
}