APIdia Launch Partner
Top Inners Fields Constructors Methods
jdk.management.jfr

pack-priv final Class FlightRecorderMXBeanImpl

extends StandardEmitterMBean
implements FlightRecorderMXBean, NotificationEmitter
Class Inheritance
All Implemented Interfaces
javax.management.NotificationEmitter, javax.management.NotificationBroadcaster, jdk.management.jfr.FlightRecorderMXBean, java.lang.management.PlatformManagedObject
Imports
java.io.IOException, .InputStream, .StringReader, java.nio.file.Path, .Paths, java.text.ParseException, java.time.Instant, java.util.ArrayList, .Arrays, .Collections, .HashMap, .List, .Map, .Objects, java.util.concurrent.ConcurrentHashMap, .CopyOnWriteArrayList, java.util.concurrent.atomic.AtomicLong, java.util.function.Consumer, .Function, .Predicate, javax.management.AttributeChangeNotification, .AttributeNotFoundException, .ListenerNotFoundException, .MBeanException, .MBeanNotificationInfo, .Notification, .NotificationBroadcasterSupport, .NotificationEmitter, .NotificationFilter, .NotificationListener, .ObjectName, .ReflectionException, .StandardEmitterMBean, jdk.jfr.Configuration, .EventType, .FlightRecorder, .FlightRecorderListener, .Recording, .RecordingState, jdk.jfr.internal.management.ManagementSupport, .StreamManager

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv class

Field Summary

Modifier and TypeField and Description
private static final String
private final Map<Long, Object>
private final List<FlightRecorderMXBeanImpl.MXBeanListener>
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final List<String>
private FlightRecorder
private final AtomicLong
private final StreamManager

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public void
public long
cloneRecording(long id, boolean stop)

Implements jdk.management.jfr.FlightRecorderMXBean.cloneRecording.

Creates a copy of an existing recording, useful for extracting parts of a recording.

public void
closeRecording(long id)

Implements jdk.management.jfr.FlightRecorderMXBean.closeRecording.

Closes the recording with the specified ID and releases any system resources that are associated with the recording.

public void
closeStream(long streamIdentifier)

Implements jdk.management.jfr.FlightRecorderMXBean.closeStream.

Closes the recording stream with the specified ID and releases any system resources that are associated with the stream.

public void
copyTo(long recording, String outputFile)

Implements jdk.management.jfr.FlightRecorderMXBean.copyTo.

Writes recording data to the specified file.

private Notification
private static MBeanNotificationInfo[]
public List<ConfigurationInfo>
getConfigurations()

Implements jdk.management.jfr.FlightRecorderMXBean.getConfigurations.

Returns the list of predefined configurations for this Java Virtual Machine (JVM).

public List<EventTypeInfo>
getEventTypes()

Implements jdk.management.jfr.FlightRecorderMXBean.getEventTypes.

Returns the list of currently registered event types.

private Recording
public ObjectName
getObjectName()

Implements java.lang.management.PlatformManagedObject.getObjectName.

Returns an ObjectName instance representing the object name of this platform managed object.

private FlightRecorder
private Recording
getRecording(long id)

public Map<String, String>
getRecordingOptions(long recording)

Implements jdk.management.jfr.FlightRecorderMXBean.getRecordingOptions.

Returns a map that contains the options for the recording with the specified ID (for example, the destination file or time span to keep recorded data).

public List<RecordingInfo>
getRecordings()

Implements jdk.management.jfr.FlightRecorderMXBean.getRecordings.

Returns the list of available recordings, not necessarily running.

public Map<String, String>
getRecordingSettings(long recording)

Implements jdk.management.jfr.FlightRecorderMXBean.getRecordingSettings.

Returns a Map that contains the settings for the recording with the specified ID, (for example, the event thresholds)

If multiple recordings are running at the same time, more data could be recorded than what is specified in the Map object.

public long
newRecording()

Implements jdk.management.jfr.FlightRecorderMXBean.newRecording.

Creates a recording, but doesn't start it.

public long
openStream(long id, Map<String, String> options)

Implements jdk.management.jfr.FlightRecorderMXBean.openStream.

Opens a data stream for the recording with the specified ID, or 0 to get data irrespective of recording.

public byte[]
readStream(long streamIdentifier)

Implements jdk.management.jfr.FlightRecorderMXBean.readStream.

Reads a portion of data from the stream with the specified ID, or returns null if no more data is available.

private void
public void
public void
public void
setConfiguration(long recording, String contents)

Implements jdk.management.jfr.FlightRecorderMXBean.setConfiguration.

Sets a configuration as a string representation for the recording with the specified ID.

private static <T, U> void
setOption(Map<String, String> options, String name, String defaultValue, Function<String, U> converter, Consumer<U> setter)

private static void
setOptionDestination(Recording recording, String destination)

public void
setPredefinedConfiguration(long recording, String configurationName)

Implements jdk.management.jfr.FlightRecorderMXBean.setPredefinedConfiguration.

Sets a predefined configuration for the recording with the specified ID.

public void
setRecordingOptions(long recording, Map<String, String> options)

Implements jdk.management.jfr.FlightRecorderMXBean.setRecordingOptions.

Configures the recording options (for example, destination file and time span to keep data).

public void
setRecordingSettings(long recording, Map<String, String> settings)

Implements jdk.management.jfr.FlightRecorderMXBean.setRecordingSettings.

Sets and replaces all previous settings for the specified recording.

public void
startRecording(long id)

Implements jdk.management.jfr.FlightRecorderMXBean.startRecording.

Starts the recording with the specified ID.

A recording that is stopped can't be restarted.

public boolean
stopRecording(long id)

Implements jdk.management.jfr.FlightRecorderMXBean.stopRecording.

Stops the running recording with the specified ID.

public long
takeSnapshot()

Implements jdk.management.jfr.FlightRecorderMXBean.takeSnapshot.

Creates a snapshot recording of all available recorded data.

private static <T, U> void
validateOption(Map<String, String> options, String name, Function<String, U> validator)

Inherited from javax.management.StandardEmitterMBean:
getNotificationInfosendNotification

Field Detail

ATTRIBUTE_RECORDINGSback to summary
private static final String ATTRIBUTE_RECORDINGS
changesback to summary
private final Map<Long, Object> changes
listenersback to summary
private final List<FlightRecorderMXBeanImpl.MXBeanListener> listeners
OPTION_DESTINATIONback to summary
private static final String OPTION_DESTINATION
OPTION_DISKback to summary
private static final String OPTION_DISK
OPTION_DUMP_ON_EXITback to summary
private static final String OPTION_DUMP_ON_EXIT
OPTION_DURATIONback to summary
private static final String OPTION_DURATION
OPTION_MAX_AGEback to summary
private static final String OPTION_MAX_AGE
OPTION_MAX_SIZEback to summary
private static final String OPTION_MAX_SIZE
OPTION_NAMEback to summary
private static final String OPTION_NAME
OPTIONSback to summary
private static final List<String> OPTIONS
recorderback to summary
private FlightRecorder recorder
sequenceNumberback to summary
private final AtomicLong sequenceNumber
streamHandlerback to summary
private final StreamManager streamHandler

Constructor Detail

FlightRecorderMXBeanImplback to summary
pack-priv FlightRecorderMXBeanImpl()

Method Detail

addNotificationListenerback to summary
public void addNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback)

Overrides javax.management.StandardEmitterMBean.addNotificationListener.

Implements javax.management.NotificationBroadcaster.addNotificationListener.

Doc from javax.management.NotificationBroadcaster.addNotificationListener.

Adds a listener to this MBean.

Annotations
@SuppressWarnings:removal
@Override
cloneRecordingback to summary
public long cloneRecording(long id, boolean stop) throws IllegalStateException

Implements jdk.management.jfr.FlightRecorderMXBean.cloneRecording.

Doc from jdk.management.jfr.FlightRecorderMXBean.cloneRecording.

Creates a copy of an existing recording, useful for extracting parts of a recording.

The cloned recording contains the same recording data as the original, but it has a new ID and a name prefixed with "Clone of recording". If the original recording is running, then the clone is also running.

Annotations
@Override
closeRecordingback to summary
public void closeRecording(long id)

Implements jdk.management.jfr.FlightRecorderMXBean.closeRecording.

Doc from jdk.management.jfr.FlightRecorderMXBean.closeRecording.

Closes the recording with the specified ID and releases any system resources that are associated with the recording.

If the recording is already closed, invoking this method has no effect.

Annotations
@Override
closeStreamback to summary
public void closeStream(long streamIdentifier) throws IOException

Implements jdk.management.jfr.FlightRecorderMXBean.closeStream.

Doc from jdk.management.jfr.FlightRecorderMXBean.closeStream.

Closes the recording stream with the specified ID and releases any system resources that are associated with the stream.

If the stream is already closed, invoking this method has no effect.

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs while trying to close the stream
copyToback to summary
public void copyTo(long recording, String outputFile) throws IOException

Implements jdk.management.jfr.FlightRecorderMXBean.copyTo.

Doc from jdk.management.jfr.FlightRecorderMXBean.copyTo.

Writes recording data to the specified file.

If this method is invoked remotely from another process, the data is written to a file named outputFile on the machine where the target Java Virtual Machine (JVM) is running. If the file location is a relative path, it is relative to the working directory where the target JVM was started.

Annotations
@Override
Exceptions
IOException:
if the recording can't be dumped due to an I/O error (for example, an invalid path)
createNotificationback to summary
private Notification createNotification(Recording recording)
createNotificationInfoback to summary
private static MBeanNotificationInfo[] createNotificationInfo()
getConfigurationsback to summary
public List<ConfigurationInfo> getConfigurations()

Implements jdk.management.jfr.FlightRecorderMXBean.getConfigurations.

Doc from jdk.management.jfr.FlightRecorderMXBean.getConfigurations.

Returns the list of predefined configurations for this Java Virtual Machine (JVM).

MBeanServer access:
The mapped type of ConfigurationInfo is CompositeData with attributes as specified in the ConfigurationInfo.from method.

Annotations
@Override
getEventTypesback to summary
public List<EventTypeInfo> getEventTypes()

Implements jdk.management.jfr.FlightRecorderMXBean.getEventTypes.

Doc from jdk.management.jfr.FlightRecorderMXBean.getEventTypes.

Returns the list of currently registered event types.

MBeanServer access:
The mapped type of EventTypeInfo is CompositeData with attributes as specified in the EventTypeInfo.from method.

Annotations
@Override
getExistingRecordingback to summary
private Recording getExistingRecording(long id)
getObjectNameback to summary
public ObjectName getObjectName()

Implements java.lang.management.PlatformManagedObject.getObjectName.

Doc from java.lang.management.PlatformManagedObject.getObjectName.

Returns an ObjectName instance representing the object name of this platform managed object.

Annotations
@Override
getRecorderback to summary
private FlightRecorder getRecorder()
Annotations
@SuppressWarnings:removal
getRecordingback to summary
private Recording getRecording(long id)
getRecordingOptionsback to summary
public Map<String, String> getRecordingOptions(long recording) throws IllegalArgumentException

Implements jdk.management.jfr.FlightRecorderMXBean.getRecordingOptions.

Doc from jdk.management.jfr.FlightRecorderMXBean.getRecordingOptions.

Returns a map that contains the options for the recording with the specified ID (for example, the destination file or time span to keep recorded data).

See FlightRecorderMXBean for available option names.

Annotations
@Override
Exceptions
IllegalArgumentException:
if no recording with the specified ID exists
getRecordingsback to summary
public List<RecordingInfo> getRecordings()

Implements jdk.management.jfr.FlightRecorderMXBean.getRecordings.

Doc from jdk.management.jfr.FlightRecorderMXBean.getRecordings.

Returns the list of available recordings, not necessarily running.

MBeanServer access:
The mapped type of RecordingInfo is CompositeData with attributes as specified in the RecordingInfo.from method.

Annotations
@Override
getRecordingSettingsback to summary
public Map<String, String> getRecordingSettings(long recording) throws IllegalArgumentException

Implements jdk.management.jfr.FlightRecorderMXBean.getRecordingSettings.

Doc from jdk.management.jfr.FlightRecorderMXBean.getRecordingSettings.

Returns a Map that contains the settings for the recording with the specified ID, (for example, the event thresholds)

If multiple recordings are running at the same time, more data could be recorded than what is specified in the Map object.

The name in the Map is the event name and the setting name separated by "#" (for example, "jdk.VMInfo#period"). The value is a textual representation of the settings value (for example, "60 s").

Annotations
@Override
Exceptions
IllegalArgumentException:
if no recording with the specified ID exists
newRecordingback to summary
public long newRecording()

Implements jdk.management.jfr.FlightRecorderMXBean.newRecording.

Doc from jdk.management.jfr.FlightRecorderMXBean.newRecording.

Creates a recording, but doesn't start it.

Annotations
@Override
openStreamback to summary
public long openStream(long id, Map<String, String> options) throws IOException

Implements jdk.management.jfr.FlightRecorderMXBean.openStream.

Doc from jdk.management.jfr.FlightRecorderMXBean.openStream.

Opens a data stream for the recording with the specified ID, or 0 to get data irrespective of recording.

Recording stream options
Name Description Default value Format Example values
startTime Specifies the point in time to start a recording stream. Due to how data is stored, some events that start or end prior to the start time may be included. Instant.MIN_VALUE.toString() ISO-8601. See Instant#toString
or milliseconds since epoch
"2015-11-03T00:00",
"1446508800000"
endTime Specifies the point in time to end a recording stream. Due to how data is stored, some events that start or end after the end time may be included. Instant.MAX_VALUE.toString() ISO-8601. See Instant#toString
or milliseconds since epoch
"2015-11-03T01:00",
"1446512400000"
blockSize Specifies the maximum number of bytes to read with a call to readStream "50000" A positive long value.

Setting blockSize to a very high value may result in OutOfMemoryError or an IllegalArgumentException, if the Java Virtual Machine (JVM) deems the value too large to handle.
"50000",
"1000000",
streamVersion Specifies format to use when reading data from a running recording "1.0" A version number with a major and minor.

To be able to read from a running recording the value must be set to
"1.0"
If an option is omitted from the map the default value is used.

The recording with the specified ID must be stopped before a stream can be opened, unless the option "streamVersion" is specified.

Annotations
@Override
Exceptions
IOException:
if the recording is closed, an I/O error occurs, or no data is available for the specified recording or interval
readStreamback to summary
public byte[] readStream(long streamIdentifier) throws IOException

Implements jdk.management.jfr.FlightRecorderMXBean.readStream.

Doc from jdk.management.jfr.FlightRecorderMXBean.readStream.

Reads a portion of data from the stream with the specified ID, or returns null if no more data is available.

To read all data for a recording, invoke this method repeatedly until null is returned.

Annotations
@Override
Exceptions
IOException:
if the stream is closed, or an I/O error occurred while trying to read the stream
removeListenersback to summary
private void removeListeners(Predicate<FlightRecorderMXBeanImpl.MXBeanListener> p)
removeNotificationListenerback to summary
public void removeNotificationListener(NotificationListener listener) throws ListenerNotFoundException

Overrides javax.management.StandardEmitterMBean.removeNotificationListener.

Implements javax.management.NotificationBroadcaster.removeNotificationListener.

Doc from javax.management.NotificationBroadcaster.removeNotificationListener.

Removes a listener from this MBean. If the listener has been registered with different handback objects or notification filters, all entries corresponding to the listener will be removed.

Annotations
@Override
Exceptions
ListenerNotFoundException:
The listener is not registered with the MBean.
removeNotificationListenerback to summary
public void removeNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback) throws ListenerNotFoundException

Overrides javax.management.StandardEmitterMBean.removeNotificationListener.

Implements javax.management.NotificationEmitter.removeNotificationListener.

Doc from javax.management.NotificationEmitter.removeNotificationListener.

Removes a listener from this MBean. The MBean must have a listener that exactly matches the given listener, filter, and handback parameters. If there is more than one such listener, only one is removed.

The filter and handback parameters may be null if and only if they are null in a listener to be removed.

Annotations
@Override
Exceptions
ListenerNotFoundException:
The listener is not registered with the MBean, or it is not registered with the given filter and handback.
setConfigurationback to summary
public void setConfiguration(long recording, String contents) throws IllegalArgumentException

Implements jdk.management.jfr.FlightRecorderMXBean.setConfiguration.

Doc from jdk.management.jfr.FlightRecorderMXBean.setConfiguration.

Sets a configuration as a string representation for the recording with the specified ID.

Annotations
@Override
Exceptions
IllegalArgumentException:
if no recording with the specified ID exists or if the configuration could not be parsed.
setOptionback to summary
private static <T, U> void setOption(Map<String, String> options, String name, String defaultValue, Function<String, U> converter, Consumer<U> setter)
setOptionDestinationback to summary
private static void setOptionDestination(Recording recording, String destination)
setPredefinedConfigurationback to summary
public void setPredefinedConfiguration(long recording, String configurationName) throws IllegalArgumentException

Implements jdk.management.jfr.FlightRecorderMXBean.setPredefinedConfiguration.

Doc from jdk.management.jfr.FlightRecorderMXBean.setPredefinedConfiguration.

Sets a predefined configuration for the recording with the specified ID.

Annotations
@Override
Exceptions
IllegalArgumentException:
if no recording with the specified ID exists
setRecordingOptionsback to summary
public void setRecordingOptions(long recording, Map<String, String> options) throws IllegalArgumentException

Implements jdk.management.jfr.FlightRecorderMXBean.setRecordingOptions.

Doc from jdk.management.jfr.FlightRecorderMXBean.setRecordingOptions.

Configures the recording options (for example, destination file and time span to keep data).

See FlightRecorderMXBean for a description of the options and values that can be used. Setting a value to null restores the value to the default value.

Annotations
@Override
Exceptions
IllegalArgumentException:
if no recording with the specified ID exists
setRecordingSettingsback to summary
public void setRecordingSettings(long recording, Map<String, String> settings) throws IllegalArgumentException

Implements jdk.management.jfr.FlightRecorderMXBean.setRecordingSettings.

Doc from jdk.management.jfr.FlightRecorderMXBean.setRecordingSettings.

Sets and replaces all previous settings for the specified recording.

A setting consists of a name/value pair, where name specifies the event and setting to configure, and the value specifies what to set it to.

The name can be formed in the following ways:

<event-name> + "#" + <setting-name>

or

<event-id> + "#" + <setting-name>

For example, to set the sample interval of the CPU Load event to once every second, use the name "jdk.CPULoad#period" and the value "1 s". If multiple events use the same name, for example if an event class is loaded in multiple class loaders, and differentiation is needed between them, then the name is "56#period". The ID for an event is obtained by invoking jdk.jfr.EventType#getId() method and is valid for the Java Virtual Machine (JVM) instance that the event is registered in.

A list of available event names is retrieved by invoking jdk.jfr.FlightRecorder#getEventTypes() and jdk.jfr.EventType#getName(). A list of available settings for an event type is obtained by invoking jdk.jfr.EventType#getSettingDescriptors() and jdk.jfr.ValueDescriptor#getName().

Annotations
@Override
Exceptions
IllegalArgumentException:
if no recording with the specified ID exists
startRecordingback to summary
public void startRecording(long id)

Implements jdk.management.jfr.FlightRecorderMXBean.startRecording.

Doc from jdk.management.jfr.FlightRecorderMXBean.startRecording.

Starts the recording with the specified ID.

A recording that is stopped can't be restarted.

Annotations
@Override
stopRecordingback to summary
public boolean stopRecording(long id)

Implements jdk.management.jfr.FlightRecorderMXBean.stopRecording.

Doc from jdk.management.jfr.FlightRecorderMXBean.stopRecording.

Stops the running recording with the specified ID.

Annotations
@Override
takeSnapshotback to summary
public long takeSnapshot()

Implements jdk.management.jfr.FlightRecorderMXBean.takeSnapshot.

Doc from jdk.management.jfr.FlightRecorderMXBean.takeSnapshot.

Creates a snapshot recording of all available recorded data.

A snapshot is a synthesized recording in a stopped state. If no data is available, a recording with size 0 is returned.

A snapshot provides stable access to data for later operations (for example, operations to change the time interval or to reduce the data size).

The caller must close the recording when access to the data is no longer needed.

Annotations
@Override
validateOptionback to summary
private static <T, U> void validateOption(Map<String, String> options, String name, Function<String, U> validator)
jdk.management.jfr back to summary

pack-priv final Class FlightRecorderMXBeanImpl.MXBeanListener

extends Object
implements FlightRecorderListener
Class Inheritance
All Implemented Interfaces
jdk.jfr.FlightRecorderListener

Field Summary

Modifier and TypeField and Description
private final NotificationFilter
private final Object
private final NotificationListener

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
recordingStateChanged(Recording recording)

Overrides default jdk.jfr.FlightRecorderListener.recordingStateChanged.

Receives notification when the state of a recording changes.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

filterback to summary
private final NotificationFilter filter
handbackback to summary
private final Object handback
listenerback to summary
private final NotificationListener listener

Constructor Detail

MXBeanListenerback to summary
public MXBeanListener(NotificationListener listener, NotificationFilter filter, Object handback)

Method Detail

recordingStateChangedback to summary
public void recordingStateChanged(Recording recording)

Overrides default jdk.jfr.FlightRecorderListener.recordingStateChanged.

Doc from jdk.jfr.FlightRecorderListener.recordingStateChanged.

Receives notification when the state of a recording changes.

Callback is invoked when a recording reaches the RUNNING, STOPPED and CLOSED state.