src/jdk.jfr/share/classes/jdk/jfr/consumer/RecordingStream.java
branchJEP-349-branch
changeset 57386 acdd0dbe37ee
parent 57380 6a7e7743b82f
child 57425 1da8552f0b59
--- a/src/jdk.jfr/share/classes/jdk/jfr/consumer/RecordingStream.java	Fri May 31 20:44:28 2019 +0200
+++ b/src/jdk.jfr/share/classes/jdk/jfr/consumer/RecordingStream.java	Mon Jun 03 16:21:47 2019 +0200
@@ -29,6 +29,7 @@
 import java.security.AccessControlContext;
 import java.security.AccessController;
 import java.time.Duration;
+import java.util.Map;
 import java.util.function.Consumer;
 
 import jdk.jfr.Configuration;
@@ -138,6 +139,37 @@
     }
 
     /**
+     * Replaces all settings for this recording stream
+     * <p>
+     * The following example shows how to set event settings for a recording.
+     *
+     * <pre>
+     * <code>
+     *     Map{@literal <}String, String{@literal >} settings = new HashMap{@literal <}{@literal >}();
+     *     settings.putAll(EventSettings.enabled("jdk.CPUSample").withPeriod(Duration.ofSeconds(2)).toMap());
+     *     settings.putAll(EventSettings.enabled(MyEvent.class).withThreshold(Duration.ofSeconds(2)).withoutStackTrace().toMap());
+     *     settings.put("jdk.ExecutionSample#period", "10 ms");
+     *     recordingStream.setSettings(settings);
+     * </code>
+     * </pre>
+     *
+     * The following example shows how to merge settings.
+     *
+     * <pre>
+     *     {@code
+     *     Map<String, String> settings = recording.getSettings();
+     *     settings.putAll(additionalSettings);
+     *     recordingStream.setSettings(settings);
+     * }
+     * </pre>
+     *
+     * @param settings the settings to set, not {@code null}
+     */
+    public void setSettings(Map<String, String> settings) {
+        recording.setSettings(settings);
+    };
+
+    /**
      * Enables event.
      *
      * @param eventClass the event to enable, not {@code null}