Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/classes/com/sun/management/DiagnosticCommandMBean.java
38831 views
/*1* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425package com.sun.management;2627import java.lang.management.PlatformManagedObject;28import javax.management.DynamicMBean;2930/**31* Management interface for the diagnostic commands for the HotSpot Virtual Machine.32*33* <p>The {code DiagnosticCommandMBean} is registered to the34* {@linkplain java.lang.management.ManagementFactory#getPlatformMBeanServer35* platform MBeanServer} as are other platform MBeans.36*37* <p>The {@link javax.management.ObjectName ObjectName} for uniquely identifying38* the diagnostic MBean within an MBeanServer is:39* <blockquote>40* {@code com.sun.management:type=DiagnosticCommand}41* </blockquote>42*43* <p>This MBean is a {@link javax.management.DynamicMBean DynamicMBean}44* and also a {@link javax.management.NotificationEmitter}.45* The {@code DiagnosticCommandMBean} is generated at runtime and is subject to46* modifications during the lifetime of the Java virtual machine.47*48* A <em>diagnostic command</em> is represented as an operation of49* the {@code DiagnosticCommandMBean} interface. Each diagnostic command has:50* <ul>51* <li>the diagnostic command name which is the name being referenced in52* the HotSpot Virtual Machine</li>53* <li>the MBean operation name which is the54* {@linkplain javax.management.MBeanOperationInfo#getName() name}55* generated for the diagnostic command operation invocation.56* The MBean operation name is implementation dependent</li>57* </ul>58*59* The recommended way to transform a diagnostic command name into a MBean60* operation name is as follows:61* <ul>62* <li>All characters from the first one to the first dot are set to be63* lower-case characters</li>64* <li>Every dot or underline character is removed and the following65* character is set to be an upper-case character</li>66* <li>All other characters are copied without modification</li>67* </ul>68*69* <p>The diagnostic command name is always provided with the meta-data on the70* operation in a field named {@code dcmd.name} (see below).71*72* <p>A diagnostic command may or may not support options or arguments.73* All the operations return {@code String} and either take74* no parameter for operations that do not support any option or argument,75* or take a {@code String[]} parameter for operations that support at least76* one option or argument.77* Each option or argument must be stored in a single String.78* Options or arguments split across several String instances are not supported.79*80* <p>The distinction between options and arguments: options are identified by81* the option name while arguments are identified by their position in the82* command line. Options and arguments are processed in the order of the array83* passed to the invocation method.84*85* <p>Like any operation of a dynamic MBean, each of these operations is86* described by {@link javax.management.MBeanOperationInfo MBeanOperationInfo}87* instance. Here's the values returned by this object:88* <ul>89* <li>{@link javax.management.MBeanOperationInfo#getName() getName()}90* returns the operation name generated from the diagnostic command name</li>91* <li>{@link javax.management.MBeanOperationInfo#getDescription() getDescription()}92* returns the diagnostic command description93* (the same as the one return in the 'help' command)</li>94* <li>{@link javax.management.MBeanOperationInfo#getImpact() getImpact()}95* returns <code>ACTION_INFO</code></li>96* <li>{@link javax.management.MBeanOperationInfo#getReturnType() getReturnType()}97* returns {@code java.lang.String}</li>98* <li>{@link javax.management.MBeanOperationInfo#getDescriptor() getDescriptor()}99* returns a Descriptor instance (see below)</li>100* </ul>101*102* <p>The {@link javax.management.Descriptor Descriptor}103* is a collection of fields containing additional104* meta-data for a JMX element. A field is a name and an associated value.105* The additional meta-data provided for an operation associated with a106* diagnostic command are described in the table below:107* <p>108*109* <table border="1" cellpadding="5">110* <tr>111* <th>Name</th><th>Type</th><th>Description</th>112* </tr>113* <tr>114* <td>dcmd.name</td><td>String</td>115* <td>The original diagnostic command name (not the operation name)</td>116* </tr>117* <tr>118* <td>dcmd.description</td><td>String</td>119* <td>The diagnostic command description</td>120* </tr>121* <tr>122* <td>dcmd.help</td><td>String</td>123* <td>The full help message for this diagnostic command (same output as124* the one produced by the 'help' command)</td>125* </tr>126* <tr>127* <td>dcmd.vmImpact</td><td>String</td>128* <td>The impact of the diagnostic command,129* this value is the same as the one printed in the 'impact'130* section of the help message of the diagnostic command, and it131* is different from the getImpact() of the MBeanOperationInfo</td>132* </tr>133* <tr>134* <td>dcmd.enabled</td><td>boolean</td>135* <td>True if the diagnostic command is enabled, false otherwise</td>136* </tr>137* <tr>138* <td>dcmd.permissionClass</td><td>String</td>139* <td>Some diagnostic command might require a specific permission to be140* executed, in addition to the MBeanPermission to invoke their141* associated MBean operation. This field returns the fully qualified142* name of the permission class or null if no permission is required143* </td>144* </tr>145* <tr>146* <td>dcmd.permissionName</td><td>String</td>147* <td>The fist argument of the permission required to execute this148* diagnostic command or null if no permission is required</td>149* </tr>150* <tr>151* <td>dcmd.permissionAction</td><td>String</td>152* <td>The second argument of the permission required to execute this153* diagnostic command or null if the permission constructor has only154* one argument (like the ManagementPermission) or if no permission155* is required</td>156* </tr>157* <tr>158* <td>dcmd.arguments</td><td>Descriptor</td>159* <td>A Descriptor instance containing the descriptions of options and160* arguments supported by the diagnostic command (see below)</td>161* </tr>162* </table>163* <p>164*165* <p>The description of parameters (options or arguments) of a diagnostic166* command is provided within a Descriptor instance. In this Descriptor,167* each field name is a parameter name, and each field value is itself168* a Descriptor instance. The fields provided in this second Descriptor169* instance are described in the table below:170*171* <table border="1" cellpadding="5">172* <tr>173* <th>Name</th><th>Type</th><th>Description</th>174* </tr>175* <tr>176* <td>dcmd.arg.name</td><td>String</td>177* <td>The name of the parameter</td>178* </tr>179* <tr>180* <td>dcmd.arg.type</td><td>String</td>181* <td>The type of the parameter. The returned String is the name of a type182* recognized by the diagnostic command parser. These types are not183* Java types and are implementation dependent.184* </td>185* </tr>186* <tr>187* <td>dcmd.arg.description</td><td>String</td>188* <td>The parameter description</td>189* </tr>190* <tr>191* <td>dcmd.arg.isMandatory</td><td>boolean</td>192* <td>True if the parameter is mandatory, false otherwise</td>193* </tr>194* <tr>195* <td>dcmd.arg.isOption</td><td>boolean</td>196* <td>True if the parameter is an option, false if it is an argument</td>197* </tr>198* <tr>199* <td>dcmd.arg.isMultiple</td><td>boolean</td>200* <td>True if the parameter can be specified several times, false201* otherwise</td>202* </tr>203* </table>204*205* <p>When the set of diagnostic commands currently supported by the Java206* Virtual Machine is modified, the {@code DiagnosticCommandMBean} emits207* a {@link javax.management.Notification} with a208* {@linkplain javax.management.Notification#getType() type} of209* <a href="{@docRoot}/../../../../api/javax/management/MBeanInfo.html#info-changed">210* {@code "jmx.mbean.info.changed"}</a> and a211* {@linkplain javax.management.Notification#getUserData() userData} that212* is the new {@code MBeanInfo}.213*214* @since 8215*/216public interface DiagnosticCommandMBean extends DynamicMBean217{218219}220221222