src/share/classes/com/sun/management/HotSpotDiagnosticMXBean.java
Print this page
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
@@ -23,26 +23,34 @@
* questions.
*/
package com.sun.management;
+import java.util.List;
import java.lang.management.PlatformManagedObject;
/**
* Diagnostic management interface for the HotSpot Virtual Machine.
* The diagnostic MBean is registered to the platform MBeanServer
* as are other platform MBeans.
*
+ * Diagnostic commands are actions that can be invoked dynamically and
+ * executed in a target Java virtual machine, mainly for troubleshooting
+ * and diagnosis.
+ *
* <p>The <tt>ObjectName</tt> for uniquely identifying the diagnostic
* MXBean within an MBeanServer is:
* <blockquote>
* <tt>com.sun.management:type=HotSpotDiagnostic</tt>
* </blockquote>
.*
* It can be obtained by calling the
* {@link PlatformManagedObject#getObjectName} method.
*
+ * All methods throw a {@code NullPointerException} if any input argument is
+ * {@code null} unless it's stated otherwise.
+ *
* @see ManagementFactory#getPlatformMXBeans(Class)
*/
public interface HotSpotDiagnosticMXBean extends PlatformManagedObject {
/**
* Dumps the heap to the <tt>outputFile</tt> file in the same
@@ -104,6 +112,104 @@
* @throws java.security.SecurityException
* if a security manager exists and the caller does not have
* ManagementPermission("control").
*/
public void setVMOption(String name, String value);
+
+ /**
+ * Returns the {@linkplain DiagnosticCommandInfo#getName() names}
+ * of all diagnostic commands.
+ * A diagnostic command is an action that can be invoked dynamically
+ * mainly for troubleshooting and diagnosis.
+ *
+ * @return the names of all diagnostic commands.
+ *
+ * @since 7u4
+ */
+ public List<String> getDiagnosticCommands();
+
+ /**
+ * Returns a {@code DiagnosticCommandInfo} object describing the
+ * diagnostic command of the specified name {@code command}
+ *
+ * @param command a diagnostic command name
+ * @return a {@code DiagnosticCommandInfo} object
+ * @throws java.lang.IllegalArgumentException if the {@code command}
+ * doesn't match any diagnostic command registered in the
+ * targeted Java virtual machine.
+ *
+ * @since 7u4
+ */
+ public DiagnosticCommandInfo getDiagnosticCommandInfo(String command);
+
+ /**
+ * Returns a list of {@code DiagnosticCommandInfo} object describing
+ * all diagnostic commands available on the targeted Java virtual machine
+ *
+ * @return a list of {@code DiagnosticCommandInfo} objects
+ *
+ * @since 7u4
+ */
+ public List<DiagnosticCommandInfo> getDiagnosticCommandInfo();
+
+ /**
+ * Returns a list of {@code DiagnosticCommandInfo} object describing
+ * all diagnostic commands specified in the {@code commands} list.
+ *
+ * @param commands {@code List} of {@code String} containing diagnostic
+ * command names
+ * @return a {@code List} of {@code DiagnosticCommandInfo} objects
+ *
+ * @throws java.lang.IllegalArgumentException if at least one
+ * command specified in the {@code commands } list
+ * doesn't match any diagnostic command registered in the
+ * targeted Java virtual machine.
+ *
+ *
+ * @since 7u4
+ */
+ public List<DiagnosticCommandInfo> getDiagnosticCommandInfo(List<String> commands);
+
+ /**
+ * Execute the command line {@code commandLine}. The command line must
+ * start with a diagnostic command name, optionally followed by parameters.
+ * Each command has its own syntax but the generic syntax for a diagnostic
+ * command line is:
+ * <blockquote>
+ * <command name> [<option>=<value>] [<argument_value>]
+ * </blockquote>
+ *
+ * @param commandLine command line to execute
+ * @return a {@code String} object containing the diagnostic command
+ * output.
+ *
+ * @throws java.lang.IllegalArgumentException if the command line doesn't
+ * match any diagnostic command registered in the virtual machine
+ * of if the parameters don't match the diagnostic command
+ * syntax.
+ *
+ * @since 7u4
+ */
+ public String execute(String commandLine);
+
+ /**
+ * Invoke the diagnostic command named {@code cmd} with the parameters
+ * specified in {@code args}. Each command has its own syntax but
+ * the generic syntax for parameters is:
+ * <blockquote>
+ * [<option>=<value>] [<argument_value>]
+ * </blockquote>
+ *
+ * @param cmd a diagnostic command name
+ * @param args the command parameters
+ * @return a {@code String} object containing the diagnostic command
+ * output.
+ *
+ * @throws java.lang.IllegalArgumentException if the command line doesn't
+ * match any diagnostic command registered in the virtual machine
+ * of if the parameters don't match the diagnostic command
+ * syntax.
+ *
+ * @since 7u4
+ */
+ public String execute(String cmd, String... args);
}