Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openjdk-multiarch-jdk8u
Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/classes/com/sun/management/DiagnosticCommandMBean.java
38831 views
1
/*
2
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
*
5
* This code is free software; you can redistribute it and/or modify it
6
* under the terms of the GNU General Public License version 2 only, as
7
* published by the Free Software Foundation. Oracle designates this
8
* particular file as subject to the "Classpath" exception as provided
9
* by Oracle in the LICENSE file that accompanied this code.
10
*
11
* This code is distributed in the hope that it will be useful, but WITHOUT
12
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14
* version 2 for more details (a copy is included in the LICENSE file that
15
* accompanied this code).
16
*
17
* You should have received a copy of the GNU General Public License version
18
* 2 along with this work; if not, write to the Free Software Foundation,
19
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20
*
21
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22
* or visit www.oracle.com if you need additional information or have any
23
* questions.
24
*/
25
26
package com.sun.management;
27
28
import java.lang.management.PlatformManagedObject;
29
import javax.management.DynamicMBean;
30
31
/**
32
* Management interface for the diagnostic commands for the HotSpot Virtual Machine.
33
*
34
* <p>The {code DiagnosticCommandMBean} is registered to the
35
* {@linkplain java.lang.management.ManagementFactory#getPlatformMBeanServer
36
* platform MBeanServer} as are other platform MBeans.
37
*
38
* <p>The {@link javax.management.ObjectName ObjectName} for uniquely identifying
39
* the diagnostic MBean within an MBeanServer is:
40
* <blockquote>
41
* {@code com.sun.management:type=DiagnosticCommand}
42
* </blockquote>
43
*
44
* <p>This MBean is a {@link javax.management.DynamicMBean DynamicMBean}
45
* and also a {@link javax.management.NotificationEmitter}.
46
* The {@code DiagnosticCommandMBean} is generated at runtime and is subject to
47
* modifications during the lifetime of the Java virtual machine.
48
*
49
* A <em>diagnostic command</em> is represented as an operation of
50
* the {@code DiagnosticCommandMBean} interface. Each diagnostic command has:
51
* <ul>
52
* <li>the diagnostic command name which is the name being referenced in
53
* the HotSpot Virtual Machine</li>
54
* <li>the MBean operation name which is the
55
* {@linkplain javax.management.MBeanOperationInfo#getName() name}
56
* generated for the diagnostic command operation invocation.
57
* The MBean operation name is implementation dependent</li>
58
* </ul>
59
*
60
* The recommended way to transform a diagnostic command name into a MBean
61
* operation name is as follows:
62
* <ul>
63
* <li>All characters from the first one to the first dot are set to be
64
* lower-case characters</li>
65
* <li>Every dot or underline character is removed and the following
66
* character is set to be an upper-case character</li>
67
* <li>All other characters are copied without modification</li>
68
* </ul>
69
*
70
* <p>The diagnostic command name is always provided with the meta-data on the
71
* operation in a field named {@code dcmd.name} (see below).
72
*
73
* <p>A diagnostic command may or may not support options or arguments.
74
* All the operations return {@code String} and either take
75
* no parameter for operations that do not support any option or argument,
76
* or take a {@code String[]} parameter for operations that support at least
77
* one option or argument.
78
* Each option or argument must be stored in a single String.
79
* Options or arguments split across several String instances are not supported.
80
*
81
* <p>The distinction between options and arguments: options are identified by
82
* the option name while arguments are identified by their position in the
83
* command line. Options and arguments are processed in the order of the array
84
* passed to the invocation method.
85
*
86
* <p>Like any operation of a dynamic MBean, each of these operations is
87
* described by {@link javax.management.MBeanOperationInfo MBeanOperationInfo}
88
* instance. Here's the values returned by this object:
89
* <ul>
90
* <li>{@link javax.management.MBeanOperationInfo#getName() getName()}
91
* returns the operation name generated from the diagnostic command name</li>
92
* <li>{@link javax.management.MBeanOperationInfo#getDescription() getDescription()}
93
* returns the diagnostic command description
94
* (the same as the one return in the 'help' command)</li>
95
* <li>{@link javax.management.MBeanOperationInfo#getImpact() getImpact()}
96
* returns <code>ACTION_INFO</code></li>
97
* <li>{@link javax.management.MBeanOperationInfo#getReturnType() getReturnType()}
98
* returns {@code java.lang.String}</li>
99
* <li>{@link javax.management.MBeanOperationInfo#getDescriptor() getDescriptor()}
100
* returns a Descriptor instance (see below)</li>
101
* </ul>
102
*
103
* <p>The {@link javax.management.Descriptor Descriptor}
104
* is a collection of fields containing additional
105
* meta-data for a JMX element. A field is a name and an associated value.
106
* The additional meta-data provided for an operation associated with a
107
* diagnostic command are described in the table below:
108
* <p>
109
*
110
* <table border="1" cellpadding="5">
111
* <tr>
112
* <th>Name</th><th>Type</th><th>Description</th>
113
* </tr>
114
* <tr>
115
* <td>dcmd.name</td><td>String</td>
116
* <td>The original diagnostic command name (not the operation name)</td>
117
* </tr>
118
* <tr>
119
* <td>dcmd.description</td><td>String</td>
120
* <td>The diagnostic command description</td>
121
* </tr>
122
* <tr>
123
* <td>dcmd.help</td><td>String</td>
124
* <td>The full help message for this diagnostic command (same output as
125
* the one produced by the 'help' command)</td>
126
* </tr>
127
* <tr>
128
* <td>dcmd.vmImpact</td><td>String</td>
129
* <td>The impact of the diagnostic command,
130
* this value is the same as the one printed in the 'impact'
131
* section of the help message of the diagnostic command, and it
132
* is different from the getImpact() of the MBeanOperationInfo</td>
133
* </tr>
134
* <tr>
135
* <td>dcmd.enabled</td><td>boolean</td>
136
* <td>True if the diagnostic command is enabled, false otherwise</td>
137
* </tr>
138
* <tr>
139
* <td>dcmd.permissionClass</td><td>String</td>
140
* <td>Some diagnostic command might require a specific permission to be
141
* executed, in addition to the MBeanPermission to invoke their
142
* associated MBean operation. This field returns the fully qualified
143
* name of the permission class or null if no permission is required
144
* </td>
145
* </tr>
146
* <tr>
147
* <td>dcmd.permissionName</td><td>String</td>
148
* <td>The fist argument of the permission required to execute this
149
* diagnostic command or null if no permission is required</td>
150
* </tr>
151
* <tr>
152
* <td>dcmd.permissionAction</td><td>String</td>
153
* <td>The second argument of the permission required to execute this
154
* diagnostic command or null if the permission constructor has only
155
* one argument (like the ManagementPermission) or if no permission
156
* is required</td>
157
* </tr>
158
* <tr>
159
* <td>dcmd.arguments</td><td>Descriptor</td>
160
* <td>A Descriptor instance containing the descriptions of options and
161
* arguments supported by the diagnostic command (see below)</td>
162
* </tr>
163
* </table>
164
* <p>
165
*
166
* <p>The description of parameters (options or arguments) of a diagnostic
167
* command is provided within a Descriptor instance. In this Descriptor,
168
* each field name is a parameter name, and each field value is itself
169
* a Descriptor instance. The fields provided in this second Descriptor
170
* instance are described in the table below:
171
*
172
* <table border="1" cellpadding="5">
173
* <tr>
174
* <th>Name</th><th>Type</th><th>Description</th>
175
* </tr>
176
* <tr>
177
* <td>dcmd.arg.name</td><td>String</td>
178
* <td>The name of the parameter</td>
179
* </tr>
180
* <tr>
181
* <td>dcmd.arg.type</td><td>String</td>
182
* <td>The type of the parameter. The returned String is the name of a type
183
* recognized by the diagnostic command parser. These types are not
184
* Java types and are implementation dependent.
185
* </td>
186
* </tr>
187
* <tr>
188
* <td>dcmd.arg.description</td><td>String</td>
189
* <td>The parameter description</td>
190
* </tr>
191
* <tr>
192
* <td>dcmd.arg.isMandatory</td><td>boolean</td>
193
* <td>True if the parameter is mandatory, false otherwise</td>
194
* </tr>
195
* <tr>
196
* <td>dcmd.arg.isOption</td><td>boolean</td>
197
* <td>True if the parameter is an option, false if it is an argument</td>
198
* </tr>
199
* <tr>
200
* <td>dcmd.arg.isMultiple</td><td>boolean</td>
201
* <td>True if the parameter can be specified several times, false
202
* otherwise</td>
203
* </tr>
204
* </table>
205
*
206
* <p>When the set of diagnostic commands currently supported by the Java
207
* Virtual Machine is modified, the {@code DiagnosticCommandMBean} emits
208
* a {@link javax.management.Notification} with a
209
* {@linkplain javax.management.Notification#getType() type} of
210
* <a href="{@docRoot}/../../../../api/javax/management/MBeanInfo.html#info-changed">
211
* {@code "jmx.mbean.info.changed"}</a> and a
212
* {@linkplain javax.management.Notification#getUserData() userData} that
213
* is the new {@code MBeanInfo}.
214
*
215
* @since 8
216
*/
217
public interface DiagnosticCommandMBean extends DynamicMBean
218
{
219
220
}
221
222