J. Duke | 319a3b9 | 2007-12-01 00:00:00 +0000 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright 2005-2006 Sun Microsystems, Inc. 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. Sun designates this |
| 8 | * particular file as subject to the "Classpath" exception as provided |
| 9 | * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
| 22 | * CA 95054 USA or visit www.sun.com if you need additional information or |
| 23 | * have any questions. |
| 24 | */ |
| 25 | |
| 26 | package com.sun.management; |
| 27 | |
| 28 | /** |
| 29 | * Diagnostic management interface for the HotSpot Virtual Machine. |
| 30 | * The diagnostic MBean is registered to the platform MBeanServer |
| 31 | * as are other platform MBeans. |
| 32 | * |
| 33 | * <p>The <tt>ObjectName</tt> for uniquely identifying the diagnostic |
| 34 | * MXBean within an MBeanServer is: |
| 35 | * <blockquote> |
| 36 | * <tt>com.sun.management:type=HotSpotDiagnostic</tt> |
| 37 | * </blockquote> |
| 38 | */ |
| 39 | public interface HotSpotDiagnosticMXBean { |
| 40 | /** |
| 41 | * Dumps the heap to the <tt>outputFile</tt> file in the same |
| 42 | * format as the hprof heap dump. |
| 43 | * <p> |
| 44 | * If this method is called remotely from another process, |
| 45 | * the heap dump output is written to a file named <tt>outputFile</tt> |
| 46 | * on the machine where the target VM is running. If outputFile is |
| 47 | * a relative path, it is relative to the working directory where |
| 48 | * the target VM was started. |
| 49 | * |
| 50 | * @param outputFile the system-dependent filename |
| 51 | * @param live if <tt>true</tt> dump only <i>live</i> objects |
| 52 | * i.e. objects that are reachable from others |
| 53 | * @throws IOException if the <tt>outputFile</tt> |
| 54 | * cannot be created, opened, or written to. |
| 55 | * @throws UnsupportedOperationException if this operation is not supported. |
| 56 | * @throws NullPointerException if <tt>outputFile</tt> is <tt>null</tt>. |
| 57 | */ |
| 58 | public void dumpHeap(String outputFile, boolean live) throws java.io.IOException; |
| 59 | |
| 60 | /** |
| 61 | * Returns a list of <tt>VMOption</tt> objects for all diagnostic options. |
| 62 | * A diagnostic option is a {@link VMOption#isWriteable writeable} |
| 63 | * VM option that can be set dynamically mainly for troubleshooting |
| 64 | * and diagnosis. |
| 65 | * |
| 66 | * @return a list of <tt>VMOption</tt> objects for all diagnostic options. |
| 67 | */ |
| 68 | public java.util.List<VMOption> getDiagnosticOptions(); |
| 69 | |
| 70 | /** |
| 71 | * Returns a <tt>VMOption</tt> object for a VM option of the given |
| 72 | * name. |
| 73 | * |
| 74 | * @return a <tt>VMOption</tt> object for a VM option of the given name. |
| 75 | * @throws NullPointerException if name is <tt>null</tt>. |
| 76 | * @throws IllegalArgumentException if a VM option of the given name |
| 77 | * does not exist. |
| 78 | */ |
| 79 | public VMOption getVMOption(String name); |
| 80 | |
| 81 | /** |
| 82 | * Sets a VM option of the given name to the specified value. |
| 83 | * The new value will be reflected in a new <tt>VMOption</tt> |
| 84 | * object returned by the {@link #getVMOption} method or |
| 85 | * the {@link #getDiagnosticOptions} method. This method does |
| 86 | * not change the value of this <tt>VMOption</tt> object. |
| 87 | * |
| 88 | * @param name Name of a VM option |
| 89 | * @param value New value of the VM option to be set |
| 90 | * |
| 91 | * @throws IllegalArgumentException if the VM option of the given name |
| 92 | * does not exist. |
| 93 | * @throws IllegalArgumentException if the new value is invalid. |
| 94 | * @throws IllegalArgumentException if the VM option is not writeable. |
| 95 | * @throws NullPointerException if name or value is <tt>null</tt>. |
| 96 | * |
| 97 | * @throws java.security.SecurityException |
| 98 | * if a security manager exists and the caller does not have |
| 99 | * ManagementPermission("control"). |
| 100 | */ |
| 101 | public void setVMOption(String name, String value); |
| 102 | } |