Package adams.core.management
Class JVisualVM
- java.lang.Object
-
- adams.core.management.Java
-
- adams.core.management.JVisualVM
-
public class JVisualVM extends Java
A helper class for the jvisualvm utility.- Author:
- fracpete (fracpete at waikato dot ac dot nz)
-
-
Field Summary
Fields Modifier and Type Field Description static String
EXECUTABLE
the jvisualvm executable when distributed with a JDK.static String
FILENAME
the props file.static String
KEY_EXECUTABLE
the key in the properties file.protected static Properties
m_Properties
the properties.-
Fields inherited from class adams.core.management.Java
BIN_DIR, CLASSPATH_FULL, CLASSPATH_SHORT, JAVA, JAVAC, MAJOR_VERSION
-
-
Constructor Summary
Constructors Constructor Description JVisualVM()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
execute(long pid)
Executes jvisualvm with default options and returns the output.static String
execute(String options, long pid)
Executes jvisualvm with default options and returns the output.static String
execute(String executable, String options, long pid)
Executes jvisualvm and returns the output.static String
getDefaultOptions()
Returns the default options ("--nosplash -J-Xmx512m") for jvisualvm.static String
getExecutablePath()
Returns the full path of the JVisualVM executable, if possible.static Properties
getProperties()
Returns the properties.static String
getPropertiesHelp()
Generates a help string for the properties.static boolean
hasCustomBinary()
Checks whether the user defined a custom binary.static boolean
isAvailable()
Checks whether jvisualvm is available at all.-
Methods inherited from class adams.core.management.Java
canStopThread, execute, getBinDir, getBinDir, getClassPath, getHome, getJavaExecutable, getMajorVersion, isJDK, isJDK, isJRE, isJRE, main
-
-
-
-
Field Detail
-
FILENAME
public static final String FILENAME
the props file.- See Also:
- Constant Field Values
-
EXECUTABLE
public static final String EXECUTABLE
the jvisualvm executable when distributed with a JDK.- See Also:
- Constant Field Values
-
KEY_EXECUTABLE
public static final String KEY_EXECUTABLE
the key in the properties file.- See Also:
- Constant Field Values
-
m_Properties
protected static Properties m_Properties
the properties.
-
-
Method Detail
-
hasCustomBinary
public static boolean hasCustomBinary()
Checks whether the user defined a custom binary.- Returns:
- true if custom binary
-
isAvailable
public static boolean isAvailable()
Checks whether jvisualvm is available at all.- Returns:
- true if available
-
getExecutablePath
public static String getExecutablePath()
Returns the full path of the JVisualVM 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 ("--nosplash -J-Xmx512m") for jvisualvm.- Returns:
- the default options
-
execute
public static String execute(long pid)
Executes jvisualvm 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()
-
execute
public static String execute(String options, long pid)
Executes jvisualvm with default options and returns the output.- Parameters:
options
- additional options for jvisualvmpid
- the process ID of the JVM to connect to, gets determined automatically if AUTO_PID- Returns:
- the output
- See Also:
getDefaultOptions()
-
execute
public static String execute(String executable, String options, long pid)
Executes jvisualvm and returns the output.- Parameters:
executable
- the jvisualvm executable to useoptions
- additional options for jvisualvmpid
- the process ID of the JVM to connect to, gets determined automatically if AUTO_PID- Returns:
- the output, if any
-
getPropertiesHelp
public static String getPropertiesHelp()
Generates a help string for the properties.- Returns:
- the help string
-
getProperties
public static Properties getProperties()
Returns the properties.- Returns:
- the properties
-
-