src/jdk.jfr/share/classes/jdk/jfr/internal/consumer/ChunkParser.java
changeset 59310 72f3dd43dd28
parent 59274 eb3e2a5c2bcd
child 59327 2c3578aa0bdf
equal deleted inserted replaced
59309:be238525d240 59310:72f3dd43dd28
   104     private LongMap<Parser> parsers;
   104     private LongMap<Parser> parsers;
   105     private boolean chunkFinished;
   105     private boolean chunkFinished;
   106 
   106 
   107     private Runnable flushOperation;
   107     private Runnable flushOperation;
   108     private ParserConfiguration configuration;
   108     private ParserConfiguration configuration;
       
   109     private volatile boolean closed;
   109 
   110 
   110     public ChunkParser(RecordingInput input) throws IOException {
   111     public ChunkParser(RecordingInput input) throws IOException {
   111         this(input, new ParserConfiguration());
   112         this(input, new ParserConfiguration());
   112     }
   113     }
   113 
   114 
   282     private boolean awaitUpdatedHeader(long absoluteChunkEnd, long filterEnd) throws IOException {
   283     private boolean awaitUpdatedHeader(long absoluteChunkEnd, long filterEnd) throws IOException {
   283         if (Logger.shouldLog(LogTag.JFR_SYSTEM_PARSER, LogLevel.INFO)) {
   284         if (Logger.shouldLog(LogTag.JFR_SYSTEM_PARSER, LogLevel.INFO)) {
   284             Logger.log(LogTag.JFR_SYSTEM_PARSER, LogLevel.INFO, "Waiting for more data (streaming). Read so far: " + chunkHeader.getChunkSize() + " bytes");
   285             Logger.log(LogTag.JFR_SYSTEM_PARSER, LogLevel.INFO, "Waiting for more data (streaming). Read so far: " + chunkHeader.getChunkSize() + " bytes");
   285         }
   286         }
   286         while (true) {
   287         while (true) {
       
   288             if (closed) {
       
   289                 return true;
       
   290             }
   287             if (chunkHeader.getLastNanos() > filterEnd)  {
   291             if (chunkHeader.getLastNanos() > filterEnd)  {
   288               return true;
   292               return true;
   289             }
   293             }
   290             chunkHeader.refresh();
   294             chunkHeader.refresh();
   291             if (absoluteChunkEnd != chunkHeader.getEnd()) {
   295             if (absoluteChunkEnd != chunkHeader.getEnd()) {
   453 
   457 
   454     public boolean isFinalChunk() {
   458     public boolean isFinalChunk() {
   455         return chunkHeader.isFinalChunk();
   459         return chunkHeader.isFinalChunk();
   456     }
   460     }
   457 
   461 
       
   462     public void close() {
       
   463         this.closed = true;
       
   464         Utils.notifyFlush();
       
   465     }
       
   466 
   458 }
   467 }