src/jdk.jfr/share/classes/jdk/jfr/Recording.java
branchJEP-349-branch
changeset 57360 5d043a159d5c
parent 53016 9f13f8aad8dc
child 57860 588a3f63efff
--- a/src/jdk.jfr/share/classes/jdk/jfr/Recording.java	Fri May 17 15:53:21 2019 +0200
+++ b/src/jdk.jfr/share/classes/jdk/jfr/Recording.java	Fri May 17 16:02:27 2019 +0200
@@ -414,6 +414,32 @@
     }
 
     /**
+     * Determines how often events are made available for streaming.
+     *
+     * @param interval the interval at which events are made available for streaming.
+     *
+     * @throws IllegalArgumentException if <code>interval</code> is negative
+     *
+     * @throws IllegalStateException if the recording is in the {@code CLOSED} state
+     */
+    public void setFlushInterval(Duration interval) {
+        Objects.nonNull(interval);
+        if (interval.isNegative()) {
+            throw new IllegalArgumentException("Stream interval can't be negative");
+        }
+        internal.setFlushInterval(interval);
+    }
+
+    /**
+     * Returns how often events are made available for streaming purposes.
+     *
+     * @return the desired stream interval, or {@code null} if no interval has been set
+     */
+    public Duration getFlushInterval() {
+        return internal.getFlushInterval();
+    }
+
+    /**
      * Determines how far back data is kept in the disk repository.
      * <p>
      * To control the amount of recording data stored on disk, the maximum length of