# HG changeset patch # User egahlin # Date 1569503584 -7200 # Node ID fe78b5a872871cb359b80b720729cbdd96d05c4c # Parent ca19b94eac7a6b0773bcf4666f02c8d417351198 Incorporate CSR feedback diff -r ca19b94eac7a -r fe78b5a87287 src/jdk.jfr/share/classes/jdk/jfr/Recording.java --- a/src/jdk.jfr/share/classes/jdk/jfr/Recording.java Wed Sep 25 22:40:41 2019 +0200 +++ b/src/jdk.jfr/share/classes/jdk/jfr/Recording.java Thu Sep 26 15:13:04 2019 +0200 @@ -413,27 +413,31 @@ internal.setMaxSize(maxSize); } - /** - * Determines how often events are made available for streaming. - * - * @param interval the interval at which events are made available for streaming. - * - * @throws IllegalArgumentException if interval 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"); + /** + * Determines how often events are made available for streaming. + * + * @param interval the interval at which events are made available for streaming. + * + * @throws IllegalArgumentException if interval is negative + * + * @throws IllegalStateException if the recording is in the {@code CLOSED} state + * + * @since 14 + */ + public void setFlushInterval(Duration interval) { + Objects.nonNull(interval); + if (interval.isNegative()) { + throw new IllegalArgumentException("Stream interval can't be negative"); + } + internal.setFlushInterval(interval); } - internal.setFlushInterval(interval); - } /** * Returns how often events are made available for streaming purposes. * * @return the flush interval, or {@code null} if no interval has been set + * + * @since 14 */ public Duration getFlushInterval() { return internal.getFlushInterval(); diff -r ca19b94eac7a -r fe78b5a87287 src/jdk.jfr/share/classes/jdk/jfr/consumer/EventStream.java --- a/src/jdk.jfr/share/classes/jdk/jfr/consumer/EventStream.java Wed Sep 25 22:40:41 2019 +0200 +++ b/src/jdk.jfr/share/classes/jdk/jfr/consumer/EventStream.java Thu Sep 26 15:13:04 2019 +0200 @@ -96,7 +96,7 @@ * *
  * 
- * try (EventStream es = EventStream.openRepository()) {
+ * try (var es = EventStream.openRepository()) {
  *   es.onEvent("jdk.CPULoad", event -> {
  *     System.out.println("CPU Load " + event.getEndTime());
  *     System.out.println(" Machine total: " + 100 * event.getFloat("machineTotal") + "%");
@@ -241,6 +241,8 @@
 
     /**
      * Releases all resources associated with this stream.
+     * 

+ * Closing a previously closed stream has no effect. */ void close(); diff -r ca19b94eac7a -r fe78b5a87287 src/jdk.jfr/share/classes/jdk/jfr/consumer/RecordingStream.java --- a/src/jdk.jfr/share/classes/jdk/jfr/consumer/RecordingStream.java Wed Sep 25 22:40:41 2019 +0200 +++ b/src/jdk.jfr/share/classes/jdk/jfr/consumer/RecordingStream.java Thu Sep 26 15:13:04 2019 +0200 @@ -54,7 +54,7 @@ *

  * 
  * Configuration c = Configuration.getConfiguration("default");
- * try (RecordingStream rs = new RecordingStream(c)) {
+ * try (var rs = new RecordingStream(c)) {
  *     rs.onEvent("jdk.GarbageCollection", System.out::println);
  *     rs.onEvent("jdk.CPULoad", System.out::println);
  *     rs.onEvent("jdk.JVMInformation", System.out::println);
@@ -104,7 +104,7 @@
      * 
      * 
      * var c = Configuration.getConfiguration("default");
-     * try (RecordingStream rs = new RecordingStream(c)) {
+     * try (var rs = new RecordingStream(c)) {
      *   rs.onEvent(System.out::println);
      *   rs.start();
      * }
@@ -156,7 +156,7 @@
      * 
      *     Configuration defaultConfiguration = Configuration.getConfiguration("default");
      *     Configuration profileConfiguration = Configuration.getConfiguration("profile");
-     *     try (RecordingStream rs = new RecordingStream(defaultConfiguration) {
+     *     try (var rs = new RecordingStream(defaultConfiguration) {
      *        rs.onEvent(System.out::println);
      *        rs.startAsync();
      *        Thread.sleep(20_000);
@@ -234,7 +234,7 @@
      * @param maxAge the length of time that data is kept, or {@code null} if
      *        infinite
      *
-     * @throws IllegalArgumentException if maxAge is negative
+     * @throws IllegalArgumentException if {@code maxAge} is negative
      *
      * @throws IllegalStateException if the recording is in the {@code CLOSED}
      *         state
@@ -256,7 +256,7 @@
      *
      * @param maxSize the amount of data to retain, {@code 0} if infinite
      *
-     * @throws IllegalArgumentException if maxSize is negative
+     * @throws IllegalArgumentException if {@code maxSize} is negative
      *
      * @throws IllegalStateException if the recording is in {@code CLOSED} state
      */
@@ -270,7 +270,7 @@
      * @param interval the interval at which events are made available to the
      *        stream, no {@code null}
      *
-     * @throws IllegalArgumentException if interval is negative
+     * @throws IllegalArgumentException if {@code interval} is negative
      *
      * @throws IllegalStateException if the stream is closed
      */