Skip to content

Commit c7d2841

Browse files
nizarbenallajaikiran
authored andcommitted
8332070: Convert package.html files in java.management to package-info.java
Reviewed-by: alanb
1 parent 7ef2831 commit c7d2841

File tree

18 files changed

+1524
-1565
lines changed

18 files changed

+1524
-1565
lines changed
Lines changed: 239 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,239 @@
1+
/*
2+
* Copyright (c) 2003, 2024, 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+
/**
27+
* Provides the management interfaces for monitoring and management of the
28+
* Java virtual machine and other components in the Java runtime.
29+
* It allows both local and remote
30+
* monitoring and management of the running Java virtual machine.
31+
*
32+
* <h2><a id="MXBean">Platform MXBean</a></h2>
33+
* <p>
34+
* A platform MXBean is a <i>managed bean</i> that
35+
* conforms to the {@linkplain javax.management JMX}
36+
* Instrumentation Specification and only uses a set of basic data types.
37+
* Each platform MXBean is a {@link java.lang.management.PlatformManagedObject}
38+
* with a unique
39+
* {@linkplain java.lang.management.PlatformManagedObject#getObjectName name}.
40+
* <h2>ManagementFactory</h2>
41+
*
42+
* <p>The {@link java.lang.management.ManagementFactory} class is the management
43+
* factory class for the Java platform. This class provides a set of
44+
* static factory methods to obtain the MXBeans for the Java platform
45+
* to allow an application to access the MXBeans directly.
46+
*
47+
* <p>A <em>platform MBeanServer</em> can be accessed with the
48+
* {@link java.lang.management.ManagementFactory#getPlatformMBeanServer
49+
* getPlatformMBeanServer} method. On the first call to this method,
50+
* it creates the platform MBeanServer and registers all platform MXBeans
51+
* including {@linkplain java.lang.management.PlatformManagedObject
52+
* platform MXBeans}.
53+
* Each platform MXBean is registered with a unique name defined in
54+
* the specification of the management interface.
55+
* This is a single MBeanServer that can be shared by different managed
56+
* components running within the same Java virtual machine.
57+
*
58+
* <h2>Interoperability</h2>
59+
*
60+
* <p>A management application and a platform MBeanServer of a running
61+
* virtual machine can interoperate
62+
* without requiring classes used by the platform MXBean interfaces.
63+
* The data types being transmitted between the JMX connector
64+
* server and the connector client are JMX
65+
* {@linkplain javax.management.openmbean.OpenType open types} and
66+
* this allows interoperation across versions.
67+
* A data type used by the MXBean interfaces are mapped to an
68+
* open type when being accessed via MBeanServer interface.
69+
* See the <a href="{@docRoot}/java.management/javax/management/MXBean.html#MXBean-spec">
70+
* MXBean</a> specification for details.
71+
*
72+
* <h2><a id="examples">Ways to Access MXBeans</a></h2>
73+
*
74+
* <p>An application can monitor the instrumentation of the
75+
* Java virtual machine and the runtime in the following ways:
76+
* <p>
77+
* <b>1. Direct access to an MXBean interface</b>
78+
* <ul>
79+
* <li>Get an MXBean instance locally in the running Java virtual machine:
80+
* <pre>
81+
* RuntimeMXBean mxbean = ManagementFactory.getRuntimeMXBean();
82+
*
83+
* // Get the standard attribute "VmVendor"
84+
* String vendor = mxbean.getVmVendor();
85+
* </pre>
86+
* <p>Or by calling the
87+
* {@link java.lang.management.ManagementFactory#getPlatformMXBean(Class)
88+
* getPlatformMXBean} or
89+
* {@link java.lang.management.ManagementFactory#getPlatformMXBeans(Class)
90+
* getPlatformMXBeans} method:
91+
* <pre>
92+
* RuntimeMXBean mxbean = ManagementFactory.getPlatformMXBean(RuntimeMXBean.class);
93+
*
94+
* // Get the standard attribute "VmVendor"
95+
* String vendor = mxbean.getVmVendor();
96+
* </pre>
97+
* </li>
98+
* <li>Construct an MXBean proxy instance that forwards the
99+
* method calls to a given MBeanServer:
100+
* <pre>
101+
* MBeanServerConnection mbs;
102+
*
103+
* // Connect to a running JVM (or itself) and get MBeanServerConnection
104+
* // that has the JVM MBeans registered in it
105+
* ...
106+
*
107+
* // Get a MBean proxy for RuntimeMXBean interface
108+
* RuntimeMXBean proxy =
109+
* {@link java.lang.management.ManagementFactory#getPlatformMXBean(MBeanServerConnection, Class)
110+
* ManagementFactory.getPlatformMXBean}(mbs,
111+
* RuntimeMXBean.class);
112+
* // Get standard attribute "VmVendor"
113+
* String vendor = proxy.getVmVendor();
114+
* </pre>
115+
* <p>A proxy is typically used to access an MXBean
116+
* in a remote Java virtual machine.
117+
* An alternative way to create an MXBean proxy is:
118+
* <pre>
119+
* RuntimeMXBean proxy =
120+
* {@link java.lang.management.ManagementFactory#newPlatformMXBeanProxy
121+
* ManagementFactory.newPlatformMXBeanProxy}(mbs,
122+
* ManagementFactory.RUNTIME_MXBEAN_NAME,
123+
* RuntimeMXBean.class);
124+
* </pre>
125+
* </li>
126+
* </ul>
127+
* <p>
128+
* <b>2. Indirect access to an MXBean interface via MBeanServer</b>
129+
* <ul>
130+
* <li>Go through the
131+
* {@link java.lang.management.ManagementFactory#getPlatformMBeanServer
132+
* platform MBeanServer} to access MXBeans locally or
133+
* a specific {@code MBeanServerConnection} to access
134+
* MXBeans remotely.
135+
* The attributes and operations of an MXBean use only
136+
* <em>JMX open types</em> which include basic data types,
137+
* {@link javax.management.openmbean.CompositeData CompositeData},
138+
* and {@link javax.management.openmbean.TabularData TabularData}
139+
* defined in {@link javax.management.openmbean.OpenType OpenType}.
140+
* <pre>
141+
* MBeanServerConnection mbs;
142+
*
143+
* // Connect to a running JVM (or itself) and get MBeanServerConnection
144+
* // that has the JVM MXBeans registered in it
145+
* ...
146+
*
147+
* try {
148+
* // Assuming the RuntimeMXBean has been registered in mbs
149+
* ObjectName oname = new ObjectName(ManagementFactory.RUNTIME_MXBEAN_NAME);
150+
*
151+
* // Get standard attribute "VmVendor"
152+
* String vendor = (String) mbs.getAttribute(oname, "VmVendor");
153+
* } catch (....) {
154+
* // Catch the exceptions thrown by ObjectName constructor
155+
* // and MBeanServer.getAttribute method
156+
* ...
157+
* }
158+
* </pre>
159+
* </li>
160+
* </ul>
161+
*
162+
*
163+
* <h2><a id="extension">Platform Extension</a></h2>
164+
*
165+
* <p>A Java virtual machine implementation may add its platform extension to
166+
* the management interface by defining platform-dependent
167+
* interfaces that extend the standard management interfaces to include
168+
* platform-specific metrics and management operations.
169+
* The static factory methods in the <code>ManagementFactory</code> class will
170+
* return the MXBeans with the platform extension.
171+
*
172+
* <p>
173+
* It is recommended to name the platform-specific attributes with
174+
* a vendor-specific prefix such as the vendor's name to
175+
* avoid collisions of the attribute name between the future extension
176+
* to the standard management interface and the platform extension.
177+
* If the future extension to the standard management interface defines
178+
* a new attribute for a management interface and the attribute name
179+
* is happened to be same as some vendor-specific attribute's name,
180+
* the applications accessing that vendor-specific attribute would have
181+
* to be modified to cope with versioning and compatibility issues.
182+
*
183+
* <p>Below is an example showing how to access an attribute
184+
* from the platform extension:
185+
*
186+
* <p>
187+
* 1) Direct access to the Oracle-specific MXBean interface
188+
* <blockquote>
189+
* <pre>
190+
* List&lt;com.sun.management.GarbageCollectorMXBean&gt; mxbeans =
191+
* ManagementFactory.getPlatformMXBeans(com.sun.management.GarbageCollectorMXBean.class);
192+
*
193+
* for (com.sun.management.GarbageCollectorMXBean gc : mxbeans) {
194+
* // Get the standard attribute "CollectionCount"
195+
* String count = mxbean.getCollectionCount();
196+
*
197+
* // Get the platform-specific attribute "LastGcInfo"
198+
* GcInfo gcinfo = gc.getLastGcInfo();
199+
* ...
200+
* }
201+
* </pre>
202+
* </blockquote>
203+
*
204+
* <p>
205+
* 2) Access the Oracle-specific MXBean interface via <code>MBeanServer</code>
206+
* through proxy
207+
*
208+
* <blockquote><pre>
209+
* MBeanServerConnection mbs;
210+
*
211+
* // Connect to a running JVM (or itself) and get MBeanServerConnection
212+
* // that has the JVM MXBeans registered in it
213+
* ...
214+
*
215+
* List&lt;com.sun.management.GarbageCollectorMXBean&gt; mxbeans =
216+
* ManagementFactory.getPlatformMXBeans(mbs, com.sun.management.GarbageCollectorMXBean.class);
217+
*
218+
* for (com.sun.management.GarbageCollectorMXBean gc : mxbeans) {
219+
* // Get the standard attribute "CollectionCount"
220+
* String count = mxbean.getCollectionCount();
221+
*
222+
* // Get the platform-specific attribute "LastGcInfo"
223+
* GcInfo gcinfo = gc.getLastGcInfo();
224+
* ...
225+
* }
226+
* </pre></blockquote>
227+
*
228+
* <p> Unless otherwise noted, passing a <code>null</code> argument to a constructor
229+
* or method in any class or interface in this package will cause a {@link
230+
* java.lang.NullPointerException NullPointerException} to be thrown.
231+
*
232+
* <p> The java.lang.management API is thread-safe.
233+
*
234+
* @see javax.management JMX Specification
235+
*
236+
* @author Mandy Chung
237+
* @since 1.5
238+
*/
239+
package java.lang.management;

0 commit comments

Comments
 (0)