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

The jdk.jfr.Recording.getStream does not work when toDisk is disabled.

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P3 P3
    • 16
    • hotspot
    • None
    • jfr
    • minimal
    • The same behavior is kept as before. The change only clarifies what happens in case of an in memory recording.
    • Java API
    • JDK

      Summary

      Clarify behavior for the jdk.jfr.Recording.getStream(Instant, Instant) method when recording in memory.

      Problem

      The jdk.jfr.Recording.getStream() allows a user to get an InputStream to read data for a stopped recording located in the disk repository. When a recording is not to disk and data is only kept temporary in native JVM buffers, it is not possible to get an InputStream,.

      Solution

      If there are no disk chunks to read in the repository, null is returned. This is also what happens when a recording is in memory (not to disk). This should be documented.

      Specification

            * Creates a data stream for a specified interval.
            * <p>
            * The stream may contain some data outside the specified range.
      +     * <p>
      +     * If the recording is not to disk, a stream can't be created
      +     * and {@code null} is returned.
            *
            * @param start the start time for the stream, or {@code null} to get data from
            *        start time of the recording
      @@ -585,7 +588,7 @@ public final class Recording implements Closeable {
            *        present time.
            *
            * @return an input stream, or {@code null} if no data is available in the
      -     *         interval.
      +     *         interval, or the recording was not recorded to disk 
            *
            * @throws IllegalArgumentException if {@code end} happens before
            *         {@code start}
            *
            * @throws IOException if a stream can't be opened
      +     * 
      +     * @see #setToDisk(boolean)
            */

            egahlin Erik Gahlin
            tzezula Tomáš Zezula
            Markus Grönlund
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: