- java.lang.Object
-
- jdk.jfr.Configuration
-
public final class Configuration extends Object
A collection of settings and metadata describing the configuration.- Since:
- 9
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Configuration
create(Reader reader)
Reads a configuration from a reader.static Configuration
create(Path path)
Reads a configuration from a file.static Configuration
getConfiguration(String name)
Returns a predefined configuration.static List<Configuration>
getConfigurations()
Returns an immutable list of predefined configurations for this JVM.String
getContents()
Returns a textual representation of the configuration, such as file contents of a JFC-file.String
getDescription()
Returns a short sentence describing the configuration, for example"Low overhead configuration safe for continuous use in production environments"
String
getLabel()
Returns a human-readable name, for example"Continuous"
.String
getName()
Returns an identifying name, for example"default"
.String
getProvider()
Returns who created the configuration, for example"Oracle"
.Map<String,String>
getSettings()
Returns the settings that describes how a recording should be configured.
-
-
-
Method Detail
-
getSettings
public Map<String,String> getSettings()
Returns the settings that describes how a recording should be configured.Modifying the returned
Map
object will not change the configuration.- Returns:
- settings, not
null
-
getName
public String getName()
Returns an identifying name, for example"default"
.- Returns:
- the name, or
null
if not available.
-
getLabel
public String getLabel()
Returns a human-readable name, for example"Continuous"
.- Returns:
- the configuration name, or
null
if not available
-
getDescription
public String getDescription()
Returns a short sentence describing the configuration, for example"Low overhead configuration safe for continuous use in production environments"
- Returns:
- the description, or
null
if not available
-
getProvider
public String getProvider()
Returns who created the configuration, for example"Oracle"
.- Returns:
- the provider, or
null
if not available.
-
getContents
public String getContents()
Returns a textual representation of the configuration, such as file contents of a JFC-file.- Returns:
- contents, or
null
if not available - See Also:
getContents()
-
create
public static Configuration create(Path path) throws IOException, ParseException
Reads a configuration from a file.- Parameters:
path
- the file containing the configuration, notnull
- Returns:
- the read
Configuration
, notnull
- Throws:
ParseException
- if the file can't be parsedIOException
- if the file can't be readSecurityException
- if a security manager exists and itscheckRead
method denies read access to the file.- See Also:
File.getPath()
,SecurityManager.checkRead(java.lang.String)
-
create
public static Configuration create(Reader reader) throws IOException, ParseException
Reads a configuration from a reader.- Parameters:
reader
- a reader containing configuration contents, notnull
- Returns:
- a configuration, not
null
- Throws:
IOException
- if an I/O error occurs while trying to read contents from the readerParseException
- if the file can't be parsed
-
getConfiguration
public static Configuration getConfiguration(String name) throws IOException, ParseException
Returns a predefined configuration.See
getConfigurations()
for available configuration names.- Parameters:
name
- the name of the configuration, for example "default" or "profile"- Returns:
- a configuration, not
null
- Throws:
IOException
- if a configuration with the given name is not available, or if an I/O error occurs while reading the configuration fileParseException
- if the configuration file can't be parsed
-
getConfigurations
public static List<Configuration> getConfigurations()
Returns an immutable list of predefined configurations for this JVM.- Returns:
- the list of predefined configurations, not
null
-
-