--- a/src/jdk.jfr/share/classes/jdk/jfr/consumer/ChunkParser.java Tue Jun 25 12:03:01 2019 +0200
+++ b/src/jdk.jfr/share/classes/jdk/jfr/consumer/ChunkParser.java Tue Jun 25 13:32:03 2019 +0200
@@ -66,10 +66,13 @@
private boolean resetEventCache;
public ChunkParser(RecordingInput input, boolean reuse) throws IOException {
- this(new ChunkHeader(input), null, 500);
+ this(new ChunkHeader(input), null, 500);
this.reuse = reuse;
}
+ public ChunkParser(ChunkParser previous) throws IOException {
+ this(new ChunkHeader(previous.input), null, 500);
+ }
private ChunkParser(ChunkHeader header, ChunkParser previous, long pollInterval) throws IOException {
this.input = header.getInput();
@@ -334,6 +337,10 @@
return chunkHeader.isLastChunk();
}
+ public ChunkParser newChunkParser() throws IOException {
+ return new ChunkParser(this);
+ }
+
public ChunkParser nextChunkParser() throws IOException {
return new ChunkParser(chunkHeader.nextHeader(), this, pollInterval);
}
--- a/src/jdk.jfr/share/classes/jdk/jfr/consumer/EventDirectoryStream.java Tue Jun 25 12:03:01 2019 +0200
+++ b/src/jdk.jfr/share/classes/jdk/jfr/consumer/EventDirectoryStream.java Tue Jun 25 13:32:03 2019 +0200
@@ -182,9 +182,8 @@
Path path = repositoryFiles.nextPath(startNanos);
startNanos = repositoryFiles.getTimestamp(path) + 1;
try (RecordingInput input = new RecordingInput(path.toFile())) {
+ chunkParser = new ChunkParser(input, this.reuse);
while (!isClosed()) {
- // chunkParser = chunkParser.nextChunkParser();
- chunkParser = new ChunkParser(input, this.reuse);
boolean awaitnewEvent = false;
while (!isClosed() && !chunkParser.isChunkFinished()) {
chunkParser.setReuse(this.reuse);
@@ -202,6 +201,7 @@
path = repositoryFiles.nextPath(startNanos);
startNanos = repositoryFiles.getTimestamp(path) + 1;
input.setFile(path);
+ chunkParser = chunkParser.newChunkParser();
}
}
}