Class OpenJ9DiagnosticsMXBeanImpl

java.lang.Object
openj9.lang.management.internal.OpenJ9DiagnosticsMXBeanImpl
All Implemented Interfaces:
PlatformManagedObject, OpenJ9DiagnosticsMXBean

public final class OpenJ9DiagnosticsMXBeanImpl extends Object implements OpenJ9DiagnosticsMXBean
Runtime type for OpenJ9DiagnosticsMXBean.

Implements functionality to dynamically configure dump options and to trigger supported dump agents.

  • Method Details

    • resetDumpOptions

      public void resetDumpOptions() throws ConfigurationUnavailableException
      Reset the JVM dump options to the settings specified when the JVM was started removing any additional configuration done since then. This method may throw a ConfigurationUnavailableException if the dump configuration cannot be altered. If this occurs it will usually be because a dump event is currently being handled.
      Specified by:
      resetDumpOptions in interface OpenJ9DiagnosticsMXBean
      Throws:
      ConfigurationUnavailableException - if the configuration cannot be changed because a dump is already in progress
    • queryDumpOptions

      public String[] queryDumpOptions()
      Returns the current dump configuration as an array of Strings, or null if an internal error occurs. The syntax of the option Strings is the same as the -Xdump command-line option, with the initial -Xdump: omitted. See the -Xdump option section on dump agents in the documentation for the OpenJ9 JVM.
      Specified by:
      queryDumpOptions in interface OpenJ9DiagnosticsMXBean
    • setDumpOptions

      public void setDumpOptions(String dumpOptions) throws InvalidOptionException, ConfigurationUnavailableException
      This function sets options for the dump subsystem. The dump option is passed in as a String. Use the same syntax as the -Xdump command-line option, with the initial -Xdump: omitted. See the -Xdump option section on dump agents in the documentation for the OpenJ9 JVM. This method may throw a ConfigurationUnavailableException if the dump configuration cannot be altered.
      Specified by:
      setDumpOptions in interface OpenJ9DiagnosticsMXBean
      Parameters:
      dumpOptions - the options string to be set
      Throws:
      InvalidOptionException - if the specified dumpOptions cannot be set or is incorrect
      ConfigurationUnavailableException - if the configuration cannot be changed because a dump is already in progress
    • triggerDump

      public void triggerDump(String dumpAgent) throws IllegalArgumentException
      This function triggers the specified dump agent. Dump agents supported - java, snap, system and heap. A java dump is in a human-readable format, and summarizes the state of the JVM. The default heap dump format (a phd file) is not human-readable. A system dump is a platform-specific file that contains information about the active processes, threads, and system memory. System dumps are usually large. The snap dump format is not human-readable and must be processed using the trace formatting tool supplied with the OpenJ9 JVM.
      Specified by:
      triggerDump in interface OpenJ9DiagnosticsMXBean
      Parameters:
      dumpAgent - the dump agent to be triggered
      Throws:
      IllegalArgumentException - if the specified dump agent is invalid or unsupported by this method
    • triggerDumpToFile

      public String triggerDumpToFile(String dumpAgent, String fileNamePattern) throws IllegalArgumentException, InvalidOptionException
      This function triggers the specified dump agent. Dump agents supported - java, snap, system and heap. The JVM will attempt to write the file to the specified file name. This may include replacement tokens as documented in the section on dump agents in the documentation for the OpenJ9 JVM. A string containing the actual filename written to is returned. This may not be the same as the requested filename for several reasons:
      • null or the empty string was specified, this will cause the JVM to write the dump to the default location based on the current dump settings and return that path.
      • Replacement (%) tokens were specified in the file name. These will have been expanded.
      • The full path is returned, if only a filename with no directory was specified the full path with the directory the dump was written to will be returned.
      • The JVM couldn't write to the specified location. In this case it will attempt to write the dump to another location, unless -Xdump:nofailover was specified on the command line.
      If a security manager exists a permission check for com.ibm.jvm.DumpPermission will be made, if this fails a SecurityException will be thrown.
      Specified by:
      triggerDumpToFile in interface OpenJ9DiagnosticsMXBean
      Parameters:
      dumpAgent - the dump agent to be triggered
      fileNamePattern - the filename to write to, which may be null, empty or include replacement tokens
      Returns:
      the file name that the dump was actually written to
      Throws:
      IllegalArgumentException - if the specified dump agent is invalid or unsupported by this method
      InvalidOptionException - if the fileNamePattern was invalid
    • triggerClassicHeapDump

      public String triggerClassicHeapDump() throws InvalidOptionException
      This function triggers the heap dump agent and requests for a heap dump in CLASSIC format.
      Specified by:
      triggerClassicHeapDump in interface OpenJ9DiagnosticsMXBean
      Returns:
      The file name of the dump that was created
      Throws:
      InvalidOptionException - if the dump operation fails
    • getInstance

      public static OpenJ9DiagnosticsMXBean getInstance()
      Singleton accessor method. Returns an instance of OpenJ9DiagnosticsMXBeanImpl.
      Returns:
      a static instance of OpenJ9DiagnosticsMXBeanImpl.
    • getObjectName

      public ObjectName getObjectName()
      Returns the object name of the MXBean.
      Specified by:
      getObjectName in interface PlatformManagedObject
      Returns:
      objectName representing the MXBean.