src/jdk.jfr/share/classes/jdk/jfr/consumer/RecordingStream.java
branchJEP-349-branch
changeset 57386 acdd0dbe37ee
parent 57380 6a7e7743b82f
child 57425 1da8552f0b59
equal deleted inserted replaced
57385:7d9d4f629f6e 57386:acdd0dbe37ee
    27 
    27 
    28 import java.io.IOException;
    28 import java.io.IOException;
    29 import java.security.AccessControlContext;
    29 import java.security.AccessControlContext;
    30 import java.security.AccessController;
    30 import java.security.AccessController;
    31 import java.time.Duration;
    31 import java.time.Duration;
       
    32 import java.util.Map;
    32 import java.util.function.Consumer;
    33 import java.util.function.Consumer;
    33 
    34 
    34 import jdk.jfr.Configuration;
    35 import jdk.jfr.Configuration;
    35 import jdk.jfr.Event;
    36 import jdk.jfr.Event;
    36 import jdk.jfr.EventSettings;
    37 import jdk.jfr.EventSettings;
   136     public EventSettings enable(String name) {
   137     public EventSettings enable(String name) {
   137         return recording.enable(name);
   138         return recording.enable(name);
   138     }
   139     }
   139 
   140 
   140     /**
   141     /**
       
   142      * Replaces all settings for this recording stream
       
   143      * <p>
       
   144      * The following example shows how to set event settings for a recording.
       
   145      *
       
   146      * <pre>
       
   147      * <code>
       
   148      *     Map{@literal <}String, String{@literal >} settings = new HashMap{@literal <}{@literal >}();
       
   149      *     settings.putAll(EventSettings.enabled("jdk.CPUSample").withPeriod(Duration.ofSeconds(2)).toMap());
       
   150      *     settings.putAll(EventSettings.enabled(MyEvent.class).withThreshold(Duration.ofSeconds(2)).withoutStackTrace().toMap());
       
   151      *     settings.put("jdk.ExecutionSample#period", "10 ms");
       
   152      *     recordingStream.setSettings(settings);
       
   153      * </code>
       
   154      * </pre>
       
   155      *
       
   156      * The following example shows how to merge settings.
       
   157      *
       
   158      * <pre>
       
   159      *     {@code
       
   160      *     Map<String, String> settings = recording.getSettings();
       
   161      *     settings.putAll(additionalSettings);
       
   162      *     recordingStream.setSettings(settings);
       
   163      * }
       
   164      * </pre>
       
   165      *
       
   166      * @param settings the settings to set, not {@code null}
       
   167      */
       
   168     public void setSettings(Map<String, String> settings) {
       
   169         recording.setSettings(settings);
       
   170     };
       
   171 
       
   172     /**
   141      * Enables event.
   173      * Enables event.
   142      *
   174      *
   143      * @param eventClass the event to enable, not {@code null}
   175      * @param eventClass the event to enable, not {@code null}
   144      *
   176      *
   145      * @throws IllegalArgumentException if {@code eventClass} is an abstract
   177      * @throws IllegalArgumentException if {@code eventClass} is an abstract