APIdia Launch Partner
Top Description Inners Constructors Methods
jdk.jfr

public abstract Class EventSettings

extends Object
Class Inheritance
Known Direct Subclasses
jdk.jfr.EventSettings.DelegatedEventSettings, jdk.jfr.Recording.RecordingSettings
Imports
java.time.Duration, java.util.List, .Map, .Objects, jdk.jfr.internal.PlatformEventType, .PlatformRecorder, .PlatformRecording, .PrivateAccess, .Type, jdk.jfr.internal.management.EventSettingsModifier

Convenience class for applying event settings to a recording.

An EventSettings object for a recording can be obtained by invoking the Recording#enable(String) method which is configured using method chaining.

The following example shows how to use the EventSettings class.

try (Recording r = new Recording()) { r.enable("jdk.CPULoad") .withPeriod(Duration.ofSeconds(1)); r.enable("jdk.FileWrite") .withoutStackTrace() .withThreshold(Duration.ofNanos(10)); r.start(); Thread.sleep(10_000); r.stop(); r.dump(Files.createTempFile("recording", ".jfr")); }
try (Recording r = new Recording()) {
    r.enable("jdk.CPULoad")
     .withPeriod(Duration.ofSeconds(1));
    r.enable("jdk.FileWrite")
     .withoutStackTrace()
     .withThreshold(Duration.ofNanos(10));
    r.start();
    Thread.sleep(10_000);
    r.stop();
    r.dump(Files.createTempFile("recording", ".jfr"));
}
Since
9

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class
private static class

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
pack-priv abstract Map<String, String>

Returns:

a settings Map, not null
toMap
()

Creates a settings Map for the event that is associated with this event setting.

public abstract EventSettings

Returns:

event settings object for further configuration, not null
with
(String
the name of the setting (for example, "threshold")
name
,
String
the value to set (for example "20 ms" not null)
value
)

Sets a setting value for the event that is associated with this event setting.

public final EventSettings

Returns:

event settings object for further configuration, not null
withoutStackTrace
()

Disables stack traces for the event that is associated with this event setting.

public final EventSettings

Returns:

event settings object for further configuration, not null
withoutThreshold
()

Specifies that a threshold is not used.

public final EventSettings

Returns:

event settings object for further configuration, not null
withPeriod
(Duration
the duration, not null
duration
)

Sets the interval for the event that is associated with this event setting.

public final EventSettings

Returns:

event settings object for further configuration, not null
withStackTrace
()

Enables stack traces for the event that is associated with this event setting.

public final EventSettings

Returns:

event settings object for further configuration, not null
withThreshold
(Duration
the duration, or null if no duration is used
duration
)

Sets the threshold for the event that is associated with this event setting.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

EventSettingsback to summary
pack-priv EventSettings()

Method Detail

toMapback to summary
pack-priv abstract Map<String, String> toMap()

Creates a settings Map for the event that is associated with this event setting.

Returns:Map<String, String>

a settings Map, not null

withback to summary
public abstract EventSettings with(String name, String value)

Sets a setting value for the event that is associated with this event setting.

Parameters
name:String

the name of the setting (for example, "threshold")

value:String

the value to set (for example "20 ms" not null)

Returns:EventSettings

event settings object for further configuration, not null

withoutStackTraceback to summary
public final EventSettings withoutStackTrace()

Disables stack traces for the event that is associated with this event setting.

Equivalent to invoking the with("stackTrace", "false") method.

Returns:EventSettings

event settings object for further configuration, not null

withoutThresholdback to summary
public final EventSettings withoutThreshold()

Specifies that a threshold is not used.

This is a convenience method, equivalent to invoking the with("threshold", "0 s") method.

Returns:EventSettings

event settings object for further configuration, not null

withPeriodback to summary
public final EventSettings withPeriod(Duration duration)

Sets the interval for the event that is associated with this event setting.

Parameters
duration:Duration

the duration, not null

Returns:EventSettings

event settings object for further configuration, not null

withStackTraceback to summary
public final EventSettings withStackTrace()

Enables stack traces for the event that is associated with this event setting.

Equivalent to invoking the with("stackTrace", "true") method.

Returns:EventSettings

event settings object for further configuration, not null

withThresholdback to summary
public final EventSettings withThreshold(Duration duration)

Sets the threshold for the event that is associated with this event setting.

Parameters
duration:Duration

the duration, or null if no duration is used

Returns:EventSettings

event settings object for further configuration, not null

jdk.jfr back to summary

pack-priv Class EventSettings.DelegatedEventSettings

extends EventSettings
Class Inheritance

Field Summary

Modifier and TypeField and Description
private final EventSettingsModifier

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
pack-priv Map<String, String>
toMap()

Implements abstract jdk.jfr.EventSettings.toMap.

Creates a settings Map for the event that is associated with this event setting.

public EventSettings
with(String name, String value)

Implements abstract jdk.jfr.EventSettings.with.

Sets a setting value for the event that is associated with this event setting.

Inherited from jdk.jfr.EventSettings:
withoutStackTracewithoutThresholdwithPeriodwithStackTracewithThreshold

Field Detail

delegateback to summary
private final EventSettingsModifier delegate

Constructor Detail

DelegatedEventSettingsback to summary
pack-priv DelegatedEventSettings(EventSettingsModifier modifier)

Method Detail

toMapback to summary
pack-priv Map<String, String> toMap()

Implements abstract jdk.jfr.EventSettings.toMap.

Doc from jdk.jfr.EventSettings.toMap.

Creates a settings Map for the event that is associated with this event setting.

Annotations
@Override
withback to summary
public EventSettings with(String name, String value)

Implements abstract jdk.jfr.EventSettings.with.

Doc from jdk.jfr.EventSettings.with.

Sets a setting value for the event that is associated with this event setting.

Annotations
@Override
jdk.jfr back to summary

private final Class EventSettings.InternalAccess

extends PrivateAccess
Class Inheritance

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public String
public PlatformEventType
public PlatformRecorder
public PlatformRecording
public Type
public boolean
public boolean
public boolean
public AnnotationElement
newAnnotation(Type annotationType, List<Object> values, boolean boot)

Implements abstract jdk.jfr.internal.PrivateAccess.newAnnotation.

public Configuration
newConfiguration(String name, String label, String description, String provider, Map<String, String> settings, String contents)

Implements abstract jdk.jfr.internal.PrivateAccess.newConfiguration.

public EventSettings
public EventType
public Recording
public SettingDescriptor
public ValueDescriptor
newValueDescriptor(String name, Type fieldType, List<AnnotationElement> annos, int dimension, boolean constantPool, String fieldName)

Implements abstract jdk.jfr.internal.PrivateAccess.newValueDescriptor.

public ValueDescriptor
public void
public void
Inherited from jdk.jfr.internal.PrivateAccess:
getInstancesetPrivateAccess

Constructor Detail

InternalAccessback to summary
private InternalAccess()

Method Detail

getFieldNameback to summary
public String getFieldName(ValueDescriptor v)

Implements abstract jdk.jfr.internal.PrivateAccess.getFieldName.

Annotations
@Override
getPlatformEventTypeback to summary
public PlatformEventType getPlatformEventType(EventType eventType)

Implements abstract jdk.jfr.internal.PrivateAccess.getPlatformEventType.

Annotations
@Override
getPlatformRecorderback to summary
public PlatformRecorder getPlatformRecorder()

Implements abstract jdk.jfr.internal.PrivateAccess.getPlatformRecorder.

Annotations
@Override
getPlatformRecordingback to summary
public PlatformRecording getPlatformRecording(Recording r)

Implements abstract jdk.jfr.internal.PrivateAccess.getPlatformRecording.

Annotations
@Override
getTypeback to summary
public Type getType(Object o)

Implements abstract jdk.jfr.internal.PrivateAccess.getType.

Annotations
@Override
isConstantPoolback to summary
public boolean isConstantPool(ValueDescriptor v)

Implements abstract jdk.jfr.internal.PrivateAccess.isConstantPool.

Annotations
@Override
isUnsignedback to summary
public boolean isUnsigned(ValueDescriptor v)

Implements abstract jdk.jfr.internal.PrivateAccess.isUnsigned.

Annotations
@Override
isVisibleback to summary
public boolean isVisible(EventType t)

Implements abstract jdk.jfr.internal.PrivateAccess.isVisible.

Annotations
@Override
newAnnotationback to summary
public AnnotationElement newAnnotation(Type annotationType, List<Object> values, boolean boot)

Implements abstract jdk.jfr.internal.PrivateAccess.newAnnotation.

Annotations
@Override
newConfigurationback to summary
public Configuration newConfiguration(String name, String label, String description, String provider, Map<String, String> settings, String contents)

Implements abstract jdk.jfr.internal.PrivateAccess.newConfiguration.

Annotations
@Override
newEventSettingsback to summary
public EventSettings newEventSettings(EventSettingsModifier esm)

Implements abstract jdk.jfr.internal.PrivateAccess.newEventSettings.

Annotations
@Override
newEventTypeback to summary
public EventType newEventType(PlatformEventType platformEventType)

Implements abstract jdk.jfr.internal.PrivateAccess.newEventType.

Annotations
@Override
newRecordingback to summary
public Recording newRecording(Boolean register)

Implements abstract jdk.jfr.internal.PrivateAccess.newRecording.

Annotations
@Override
newSettingDescriptorback to summary
public SettingDescriptor newSettingDescriptor(Type type, String name, String defaultValue, List<AnnotationElement> annotations)

Implements abstract jdk.jfr.internal.PrivateAccess.newSettingDescriptor.

Annotations
@Override
newValueDescriptorback to summary
public ValueDescriptor newValueDescriptor(String name, Type fieldType, List<AnnotationElement> annos, int dimension, boolean constantPool, String fieldName)

Implements abstract jdk.jfr.internal.PrivateAccess.newValueDescriptor.

Annotations
@Override
newValueDescriptorback to summary
public ValueDescriptor newValueDescriptor(Class<?> type, String name)

Implements abstract jdk.jfr.internal.PrivateAccess.newValueDescriptor.

Annotations
@Override
setAnnotationsback to summary
public void setAnnotations(ValueDescriptor v, List<AnnotationElement> a)

Implements abstract jdk.jfr.internal.PrivateAccess.setAnnotations.

Annotations
@Override
setAnnotationsback to summary
public void setAnnotations(SettingDescriptor s, List<AnnotationElement> a)

Implements abstract jdk.jfr.internal.PrivateAccess.setAnnotations.

Annotations
@Override