Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8285872

JFR: Remove finalize() methods

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P3 P3
    • 19
    • None
    • hotspot
    • None
    • jfr
    • b22

      The RepositoryChunk::finalize() method has been kept since the inception of JFR, before try-with-resources (JDK 7) and Cleaner (JDK 9) existed. The method should be removed now that finalization is deprecated for removal.

      RepositoryChunks are reference counted and when a recording is closed, chunks that are not referenced by a recording are removed from the disk repository. Users can get a listing of not closed recordings by invoking FlightRecorder::getRecordings() so they own the lifecycle already. If a user forget to close a recording, the data will be kept in the repository.

      ChunkInputStream och ChunkChannel have finalize() methods and increases the reference counter when copying data out from the disk repository. If an IOException happens during file reading, they are closed and the reference counter decreased for the remaining chunks. Finalizers are not needed.

            egahlin Erik Gahlin
            egahlin Erik Gahlin
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: