Incorporate CSR feedback JEP-349-branch
authoregahlin
Thu, 26 Sep 2019 15:13:04 +0200
branchJEP-349-branch
changeset 58357 fe78b5a87287
parent 58343 ca19b94eac7a
child 58368 622f3661ed67
Incorporate CSR feedback
src/jdk.jfr/share/classes/jdk/jfr/Recording.java
src/jdk.jfr/share/classes/jdk/jfr/consumer/EventStream.java
src/jdk.jfr/share/classes/jdk/jfr/consumer/RecordingStream.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 <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");
+        /**
+         * 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
+         *
+         * @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();
--- 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 @@
  *
  * <pre>
  * <code>
- * 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.
+     * <p>
+     * Closing a previously closed stream has no effect.
      */
     void close();
 
--- 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 @@
  * <pre>
  * <code>
  * 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 @@
      * <pre>
      * <code>
      * 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 @@
      * <code>
      *     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 <code>maxAge</code> 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 <code>maxSize</code> 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 <code>interval</code> is negative
+     * @throws IllegalArgumentException if {@code interval} is negative
      *
      * @throws IllegalStateException if the stream is closed
      */