jdk/src/share/classes/java/lang/management/package.html
author jfranck
Mon, 30 Sep 2013 11:18:18 +0200
changeset 20481 2735b307d256
parent 14342 8435a30053c1
child 21334 c60dfce46a77
permissions -rw-r--r--
8007072: Update Core Reflection for Type Annotations to match latest spec 8022324: j.l.Class.getAnnotatedInterfaces() for array type returns wrong value 8024915: j.l.r.Executable.getAnnotatedReceiverType() should return null for static methods Summary: Update javadoc and implementation of reflection for type annotations to match latest spec Reviewed-by: darcy
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
<!--
14342
8435a30053c1 7197491: update copyright year to match last edit in jdk8 jdk repository
alanb
parents: 9013
diff changeset
     2
 Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     7
 published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     9
 by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
 Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    22
 or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    23
 questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
-->
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
<html>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
<body bgcolor="white">
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
9013
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
    30
Provides the management interfaces for monitoring and management of the
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
    31
Java virtual machine and other components in the Java runtime.
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
    32
It allows both local and remote
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
    33
monitoring and management of the running Java virtual machine.
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
    34
<p>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
9013
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
    36
<h4><a name="MXBean">Platform MXBean</a></h4>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
<p>
9013
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
    38
A platform MXBean is a <i>managed bean</i> that
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
    39
conforms to the <a href="../../../javax/management/package-summary.html">JMX</a>
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
    40
Instrumentation Specification and only uses a set of basic data types.
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
    41
Each platform MXBean is a {@link java.lang.management.PlatformManagedObject}
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
    42
with a unique
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
    43
{@linkplain java.lang.management.PlatformManagedObject#getObjectName name}.
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
    44
<p>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
<h4>ManagementFactory</h4>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
9013
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
    47
<p>The {@link java.lang.management.ManagementFactory} class is the management
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
    48
factory class for the Java platform.  This class provides a set of
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
static factory methods to obtain the MXBeans for the Java platform
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
to allow an application to access the MXBeans directly.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
<p>A <em>platform MBeanServer</em> can be accessed with the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
{@link java.lang.management.ManagementFactory#getPlatformMBeanServer
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
 getPlatformMBeanServer} method.  On the first call to this method,
9013
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
    55
it creates the platform MBeanServer and registers all platform MXBeans
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
    56
including {@linkplain java.lang.management.PlatformManagedObject
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
    57
platform MXBeans}.
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
    58
Each platform MXBean is registered with a unique name defined in
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
    59
the specification of the management interface.
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
    60
This is a single MBeanServer that can be shared by different managed
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
components running within the same Java virtual machine.
9013
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
    62
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
<h4>Interoperability</h4>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
9013
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
    65
<p>A management application and a platform MBeanServer of a running
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
    66
virtual machine can interoperate
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
without requiring classes used by the platform MXBean interfaces.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
The data types being transmitted between the JMX connector
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
server and the connector client are JMX
9013
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
    70
{@linkplain javax.management.openmbean.OpenType open types} and
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
this allows interoperation across versions.
9013
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
    72
A data type used by the MXBean interfaces are mapped to an
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
    73
open type when being accessed via MBeanServer interface.
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
    74
See the <a href="../../../javax/management/MXBean.html#MXBean-spec">
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
    75
MXBean</a> specification for details.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
<h4><a name="examples">Ways to Access MXBeans</a></h4>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
9013
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
    79
<p>An application can monitor the instrumentation of the
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
    80
Java virtual machine and the runtime in the following ways:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
<p>
9013
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
    82
<b>1. Direct access to an MXBean interface</b>
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
    83
<p>
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
    84
<ul>
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
    85
<li>Get an MXBean instance locally in the running Java virtual machine:<p>
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
    86
<pre>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
   RuntimeMXBean mxbean = ManagementFactory.getRuntimeMXBean();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
   // Get the standard attribute "VmVendor"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
   String vendor = mxbean.getVmVendor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
</pre>
9013
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
    92
<p>Or by calling the
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
    93
        {@link java.lang.management.ManagementFactory#getPlatformMXBean(Class)
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
    94
               getPlatformMXBean} or
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
    95
        {@link java.lang.management.ManagementFactory#getPlatformMXBeans(Class)
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
    96
               getPlatformMXBeans} method:
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
    97
<pre>
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
    98
   RuntimeMXBean mxbean = ManagementFactory.getPlatformMXBean(RuntimeMXBean.class);
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
    99
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
   100
   // Get the standard attribute "VmVendor"
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
   101
   String vendor = mxbean.getVmVendor();
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
   102
</pre>
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
   103
<p>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
</li>
9013
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
   105
<li>Construct an MXBean proxy instance that forwards the
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
   106
    method calls to a given MBeanServer:<p>
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
   107
<pre>
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
   108
   MBeanServerConnection mbs;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
9013
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
   110
   // Connect to a running JVM (or itself) and get MBeanServerConnection
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
   111
   // that has the JVM MBeans registered in it
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
   112
   ...
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
   113
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
   114
   // Get a MBean proxy for RuntimeMXBean interface
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
   115
   RuntimeMXBean proxy =
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
   116
       {@link java.lang.management.ManagementFactory#getPlatformMXBean(MBeanServerConnection, Class)
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
   117
       ManagementFactory.getPlatformMXBean}(mbs,
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
   118
                                           RuntimeMXBean.class);
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
   119
   // Get standard attribute "VmVendor"
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
   120
   String vendor = proxy.getVmVendor();
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
   121
</pre>
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
   122
<p>A proxy is typically used to access an MXBean
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
   123
   in a remote Java virtual machine.
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
   124
   An alternative way to create an MXBean proxy is:
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
   125
<pre>
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
   126
   RuntimeMXBean proxy =
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
   127
       {@link java.lang.management.ManagementFactory#newPlatformMXBeanProxy
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
   128
              ManagementFactory.newPlatformMXBeanProxy}(mbs,
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
   129
                                                ManagementFactory.RUNTIME_MXBEAN_NAME,
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
   130
                                                RuntimeMXBean.class);
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
   131
</pre>
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
   132
</li>
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
   133
</ul>
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
   134
<p>
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
   135
<b>2. Indirect access to an MXBean interface via MBeanServer</b><p>
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
   136
<ul>
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
   137
<li>Go through the
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
   138
    {@link java.lang.management.ManagementFactory#getPlatformMBeanServer
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
   139
    platform MBeanServer} to access MXBeans locally or
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
   140
    a specific {@code MBeanServerConnection} to access
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
   141
    MXBeans remotely.
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
   142
    The attributes and operations of an MXBean use only
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
   143
    <em>JMX open types</em> which include basic data types,
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
   144
    {@link javax.management.openmbean.CompositeData CompositeData},
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
   145
    and {@link javax.management.openmbean.TabularData TabularData}
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
   146
    defined in {@link javax.management.openmbean.OpenType OpenType}.<p>
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
   147
<pre>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
   MBeanServerConnection mbs;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
   // Connect to a running JVM (or itself) and get MBeanServerConnection
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
   // that has the JVM MXBeans registered in it
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
   ...
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
   try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
       // Assuming the RuntimeMXBean has been registered in mbs
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
       ObjectName oname = new ObjectName(ManagementFactory.RUNTIME_MXBEAN_NAME);
9013
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
   157
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
       // Get standard attribute "VmVendor"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
       String vendor = (String) mbs.getAttribute(oname, "VmVendor");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
   } catch (....) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
       // Catch the exceptions thrown by ObjectName constructor
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
       // and MBeanServer.getAttribute method
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
       ...
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
   }
9013
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
   165
</pre>
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
   166
</li>
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
   167
</ul>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
<h4><a name="extension">Platform Extension</a></h4>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
9013
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
   172
<p>A Java virtual machine implementation may add its platform extension to
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
the management interface by defining platform-dependent
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
interfaces that extend the standard management interfaces to include
9013
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
   175
platform-specific metrics and management operations.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
The static factory methods in the <tt>ManagementFactory</tt> class will
9013
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
   177
return the MXBeans with the platform extension.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
It is recommended to name the platform-specific attributes with
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
a vendor-specific prefix such as the vendor's name to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
avoid collisions of the attribute name between the future extension
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
to the standard management interface and the platform extension.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
If the future extension to the standard management interface defines
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
a new attribute for a management interface and the attribute name
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
is happened to be same as some vendor-specific attribute's name,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
the applications accessing that vendor-specific attribute would have
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
to be modified to cope with versioning and compatibility issues.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
9013
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
   190
<p>Below is an example showing how to access an attribute
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
   191
from the platform extension:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
<p>
9013
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
   194
1) Direct access to the Oracle-specific MXBean interface
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
   195
<blockquote>
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
   196
<pre>
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
   197
   List&lt;com.sun.management.GarbageCollectorMXBean&gt; mxbeans =
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
   198
       ManagementFactory.getPlatformMXBeans(com.sun.management.GarbageCollectorMXBean.class);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
9013
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
   200
   for (com.sun.management.GarbageCollectorMXBean gc : mxbeans) {
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
   201
       // Get the standard attribute "CollectionCount"
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
   202
       String count = mxbean.getCollectionCount();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
9013
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
   204
       // Get the platform-specific attribute "LastGcInfo"
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
   205
       GcInfo gcinfo = gc.getLastGcInfo();
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
   206
       ...
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
   207
   }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
</pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
</blockquote>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
<p>
9013
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
   212
2) Access the Oracle-specific MXBean interface via <tt>MBeanServer</tt>
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
   213
   through proxy
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
<blockquote><pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
   MBeanServerConnection mbs;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
   // Connect to a running JVM (or itself) and get MBeanServerConnection
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
   // that has the JVM MXBeans registered in it
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
   ...
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
9013
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
   222
   List&lt;com.sun.management.GarbageCollectorMXBean&gt; mxbeans =
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
   223
       ManagementFactory.getPlatformMXBeans(mbs, com.sun.management.GarbageCollectorMXBean.class);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
9013
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
   225
   for (com.sun.management.GarbageCollectorMXBean gc : mxbeans) {
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
   226
       // Get the standard attribute "CollectionCount"
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
   227
       String count = mxbean.getCollectionCount();
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
   228
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
   229
       // Get the platform-specific attribute "LastGcInfo"
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
   230
       GcInfo gcinfo = gc.getLastGcInfo();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
       ...
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
   }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
</pre></blockquote>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
<p> Unless otherwise noted, passing a <tt>null</tt> argument to a constructor
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
or method in any class or interface in this package will cause a {@link
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
java.lang.NullPointerException NullPointerException} to be thrown.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
<p> The java.lang.management API is thread-safe.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
@see <a href="../../../javax/management/package-summary.html">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
     JMX Specification.</a>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
@author  Mandy Chung
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
@since   1.5
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
</body>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
</html>