001: /*
002: * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved.
003: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
004: *
005: * This code is free software; you can redistribute it and/or modify it
006: * under the terms of the GNU General Public License version 2 only, as
007: * published by the Free Software Foundation. Sun designates this
008: * particular file as subject to the "Classpath" exception as provided
009: * by Sun in the LICENSE file that accompanied this code.
010: *
011: * This code is distributed in the hope that it will be useful, but WITHOUT
012: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
013: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
014: * version 2 for more details (a copy is included in the LICENSE file that
015: * accompanied this code).
016: *
017: * You should have received a copy of the GNU General Public License version
018: * 2 along with this work; if not, write to the Free Software Foundation,
019: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
020: *
021: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
022: * CA 95054 USA or visit www.sun.com if you need additional information or
023: * have any questions.
024: */
025:
026: package com.sun.management;
027:
028: /**
029: * Diagnostic management interface for the HotSpot Virtual Machine.
030: * The diagnostic MBean is registered to the platform MBeanServer
031: * as are other platform MBeans.
032: *
033: * <p>The <tt>ObjectName</tt> for uniquely identifying the diagnostic
034: * MXBean within an MBeanServer is:
035: * <blockquote>
036: * <tt>com.sun.management:type=HotSpotDiagnostic</tt>
037: * </blockquote>
038: */
039: public interface HotSpotDiagnosticMXBean {
040: /**
041: * Dumps the heap to the <tt>outputFile</tt> file in the same
042: * format as the hprof heap dump.
043: * <p>
044: * If this method is called remotely from another process,
045: * the heap dump output is written to a file named <tt>outputFile</tt>
046: * on the machine where the target VM is running. If outputFile is
047: * a relative path, it is relative to the working directory where
048: * the target VM was started.
049: *
050: * @param outputFile the system-dependent filename
051: * @param live if <tt>true</tt> dump only <i>live</i> objects
052: * i.e. objects that are reachable from others
053: * @throws IOException if the <tt>outputFile</tt>
054: * cannot be created, opened, or written to.
055: * @throws UnsupportedOperationException if this operation is not supported.
056: * @throws NullPointerException if <tt>outputFile</tt> is <tt>null</tt>.
057: */
058: public void dumpHeap(String outputFile, boolean live)
059: throws java.io.IOException;
060:
061: /**
062: * Returns a list of <tt>VMOption</tt> objects for all diagnostic options.
063: * A diagnostic option is a {@link VMOption#isWriteable writeable}
064: * VM option that can be set dynamically mainly for troubleshooting
065: * and diagnosis.
066: *
067: * @return a list of <tt>VMOption</tt> objects for all diagnostic options.
068: */
069: public java.util.List<VMOption> getDiagnosticOptions();
070:
071: /**
072: * Returns a <tt>VMOption</tt> object for a VM option of the given
073: * name.
074: *
075: * @return a <tt>VMOption</tt> object for a VM option of the given name.
076: * @throws NullPointerException if name is <tt>null</tt>.
077: * @throws IllegalArgumentException if a VM option of the given name
078: * does not exist.
079: */
080: public VMOption getVMOption(String name);
081:
082: /**
083: * Sets a VM option of the given name to the specified value.
084: * The new value will be reflected in a new <tt>VMOption</tt>
085: * object returned by the {@link #getVMOption} method or
086: * the {@link #getDiagnosticOptions} method. This method does
087: * not change the value of this <tt>VMOption</tt> object.
088: *
089: * @param name Name of a VM option
090: * @param value New value of the VM option to be set
091: *
092: * @throws IllegalArgumentException if the VM option of the given name
093: * does not exist.
094: * @throws IllegalArgumentException if the new value is invalid.
095: * @throws IllegalArgumentException if the VM option is not writeable.
096: * @throws NullPointerException if name or value is <tt>null</tt>.
097: *
098: * @throws java.security.SecurityException
099: * if a security manager exists and the caller does not have
100: * ManagementPermission("control").
101: */
102: public void setVMOption(String name, String value);
103: }
|