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

Reviewed-by: mgronlun
This commit is contained in:
Erik Gahlin 2020-12-07 11:09:25 +00:00
parent 04ce8e3840
commit 09707dd4f2

View File

@ -577,6 +577,9 @@ public final class Recording implements Closeable {
* 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,12 +588,14 @@ 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)
*/
public InputStream getStream(Instant start, Instant end) throws IOException {
if (start != null && end != null && end.isBefore(start)) {