jdk/src/jdk.management/share/classes/com/sun/management/HotSpotDiagnosticMXBean.java
author sjiang
Fri, 17 Apr 2015 09:40:02 +0200
changeset 30355 e37c7eba132f
parent 29102 jdk/src/java.management/share/classes/com/sun/management/HotSpotDiagnosticMXBean.java@fa8bbdfd8750
child 32210 958d823579c3
permissions -rw-r--r--
8042901: Allow com.sun.management to be in a different module to java.lang.management Reviewed-by: mchung, dfuchs, erikj, jbachorik
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
27493
8a2a7d7c52a0 8061616: HotspotDiagnosticMXBean.getVMOption() throws IllegalArgumentException for flags of type double
jbachorik
parents: 25859
diff changeset
     2
 * Copyright (c) 2005, 2014, 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: 715
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: 715
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: 715
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 715
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 715
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
package com.sun.management;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
401
ef01e0dccd63 6610094: Add generic support for platform MXBeans of any type (also fixed 6681031)
mchung
parents: 2
diff changeset
    28
import java.lang.management.PlatformManagedObject;
ef01e0dccd63 6610094: Add generic support for platform MXBeans of any type (also fixed 6681031)
mchung
parents: 2
diff changeset
    29
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
 * Diagnostic management interface for the HotSpot Virtual Machine.
11365
05d995976571 7104647: Adding a diagnostic command framework
fparain
parents: 5506
diff changeset
    32
 *
05d995976571 7104647: Adding a diagnostic command framework
fparain
parents: 5506
diff changeset
    33
 * <p>The diagnostic MBean is registered to the platform MBeanServer
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
 * as are other platform MBeans.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
 * <p>The <tt>ObjectName</tt> for uniquely identifying the diagnostic
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 * MXBean within an MBeanServer is:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 * <blockquote>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 *    <tt>com.sun.management:type=HotSpotDiagnostic</tt>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 * </blockquote>
401
ef01e0dccd63 6610094: Add generic support for platform MXBeans of any type (also fixed 6681031)
mchung
parents: 2
diff changeset
    41
.*
ef01e0dccd63 6610094: Add generic support for platform MXBeans of any type (also fixed 6681031)
mchung
parents: 2
diff changeset
    42
 * It can be obtained by calling the
ef01e0dccd63 6610094: Add generic support for platform MXBeans of any type (also fixed 6681031)
mchung
parents: 2
diff changeset
    43
 * {@link PlatformManagedObject#getObjectName} method.
ef01e0dccd63 6610094: Add generic support for platform MXBeans of any type (also fixed 6681031)
mchung
parents: 2
diff changeset
    44
 *
11365
05d995976571 7104647: Adding a diagnostic command framework
fparain
parents: 5506
diff changeset
    45
 * All methods throw a {@code NullPointerException} if any input argument is
05d995976571 7104647: Adding a diagnostic command framework
fparain
parents: 5506
diff changeset
    46
 * {@code null} unless it's stated otherwise.
05d995976571 7104647: Adding a diagnostic command framework
fparain
parents: 5506
diff changeset
    47
 *
29102
fa8bbdfd8750 8073713: javadoc warnings in serviceability code
sla
parents: 27493
diff changeset
    48
 * @see java.lang.management.ManagementFactory#getPlatformMXBeans(Class)
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
 */
20742
4ae78e8060d6 8008662: Add @jdk.Exported to JDK-specific/exported APIs
alanb
parents: 11849
diff changeset
    50
@jdk.Exported
401
ef01e0dccd63 6610094: Add generic support for platform MXBeans of any type (also fixed 6681031)
mchung
parents: 2
diff changeset
    51
public interface HotSpotDiagnosticMXBean extends PlatformManagedObject {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
     * Dumps the heap to the <tt>outputFile</tt> file in the same
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
     * format as the hprof heap dump.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
     * If this method is called remotely from another process,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
     * the heap dump output is written to a file named <tt>outputFile</tt>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
     * on the machine where the target VM is running.  If outputFile is
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
     * a relative path, it is relative to the working directory where
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
     * the target VM was started.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
     * @param  outputFile the system-dependent filename
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
     * @param  live if <tt>true</tt> dump only <i>live</i> objects
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
     *         i.e. objects that are reachable from others
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
     * @throws IOException if the <tt>outputFile</tt>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
     *                     cannot be created, opened, or written to.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
     * @throws UnsupportedOperationException if this operation is not supported.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
     * @throws NullPointerException if <tt>outputFile</tt> is <tt>null</tt>.
20826
d9ee83c801f6 8016357: Update hotspot diagnostic class
sgabdura
parents: 11849
diff changeset
    69
     * @throws SecurityException
d9ee83c801f6 8016357: Update hotspot diagnostic class
sgabdura
parents: 11849
diff changeset
    70
     *         If a security manager exists and its {@link
d9ee83c801f6 8016357: Update hotspot diagnostic class
sgabdura
parents: 11849
diff changeset
    71
     *         java.lang.SecurityManager#checkWrite(java.lang.String)}
d9ee83c801f6 8016357: Update hotspot diagnostic class
sgabdura
parents: 11849
diff changeset
    72
     *         method denies write access to the named file
d9ee83c801f6 8016357: Update hotspot diagnostic class
sgabdura
parents: 11849
diff changeset
    73
     *         or the caller does not have ManagmentPermission("control").
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
    public void dumpHeap(String outputFile, boolean live) throws java.io.IOException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
     * Returns a list of <tt>VMOption</tt> objects for all diagnostic options.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
     * A diagnostic option is a {@link VMOption#isWriteable writeable}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
     * VM option that can be set dynamically mainly for troubleshooting
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
     * and diagnosis.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
     * @return a list of <tt>VMOption</tt> objects for all diagnostic options.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
    public java.util.List<VMOption> getDiagnosticOptions();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
     * Returns a <tt>VMOption</tt> object for a VM option of the given
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
     * name.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
     * @return a <tt>VMOption</tt> object for a VM option of the given name.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
     * @throws NullPointerException if name is <tt>null</tt>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
     * @throws IllegalArgumentException if a VM option of the given name
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
     *                                     does not exist.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
    public VMOption getVMOption(String name);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
     * Sets a VM option of the given name to the specified value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
     * The new value will be reflected in a new <tt>VMOption</tt>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
     * object returned by the {@link #getVMOption} method or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
     * the {@link #getDiagnosticOptions} method.  This method does
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
     * not change the value of this <tt>VMOption</tt> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
     * @param name Name of a VM option
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
     * @param value New value of the VM option to be set
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
     * @throws IllegalArgumentException if the VM option of the given name
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
     *                                     does not exist.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
     * @throws IllegalArgumentException if the new value is invalid.
27493
8a2a7d7c52a0 8061616: HotspotDiagnosticMXBean.getVMOption() throws IllegalArgumentException for flags of type double
jbachorik
parents: 25859
diff changeset
   111
     * @throws IllegalArgumentException if the VM option is not writable.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
     * @throws NullPointerException if name or value is <tt>null</tt>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
     *
11365
05d995976571 7104647: Adding a diagnostic command framework
fparain
parents: 5506
diff changeset
   114
     * @throws  java.lang.SecurityException
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
     *     if a security manager exists and the caller does not have
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
     *     ManagementPermission("control").
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
    public void setVMOption(String name, String value);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
}