Class JMap


  • public class JMap
    extends Java
    A helper class for the jmap utility.
    Version:
    $Revision$
    Author:
    fracpete (fracpete at waikato dot ac dot nz)
    • Constructor Detail

      • JMap

        public JMap()
    • Method Detail

      • isAvailable

        public static boolean isAvailable()
        Checks whether jmap is available at all.
        Returns:
        true if available
      • getExecutablePath

        public static String getExecutablePath()
        Returns the full path of the JMap executable, if possible.
        Returns:
        the full path of the executable if possible, otherwise just the executable
      • getDefaultOptions

        public static String getDefaultOptions()
        Returns the default options ("-histo:live") for jmap.
        Returns:
        the default options
      • execute

        public static String execute​(long pid)
        Executes jmap with default options and returns the output.
        Parameters:
        pid - the process ID of the JVM to connect to, gets determined automatically if AUTO_PID
        Returns:
        the output
        See Also:
        getDefaultOptions(), Java#AUTO_PID
      • execute

        public static String execute​(String options,
                                     long pid)
        Executes jmap and returns the output.
        Parameters:
        options - additional options for jmap
        pid - the process ID of the JVM to connect to, gets determined automatically if AUTO_PID
        Returns:
        the output
        See Also:
        Java#AUTO_PID
      • execute

        public static String execute​(String executable,
                                     String options,
                                     long pid)
        Executes jmap and returns the output.
        Parameters:
        executable - the jmap executable to use
        options - additional options for jmap
        pid - the process ID of the JVM to connect to, gets determined automatically if AUTO_PID
        Returns:
        the output
        See Also:
        Java#AUTO_PID