jdk/src/share/classes/java/lang/management/OperatingSystemMXBean.java
author ohair
Tue, 25 May 2010 15:58:33 -0700
changeset 5506 202f599c92aa
parent 715 f16baef3a20e
permissions -rw-r--r--
6943119: Rebrand source copyright notices Reviewed-by: darcy, weijun
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 715
diff changeset
     2
 * Copyright (c) 2003, 2008, 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 java.lang.management;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
 * The management interface for the operating system on which
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
 * the Java virtual machine is running.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
 * <p> A Java virtual machine has a single instance of the implementation
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
 * class of this interface.  This instance implementing this interface is
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
 * an <a href="ManagementFactory.html#MXBean">MXBean</a>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
 * that can be obtained by calling
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
 * the {@link ManagementFactory#getOperatingSystemMXBean} method or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 * from the {@link ManagementFactory#getPlatformMBeanServer
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 * platform <tt>MBeanServer</tt>} method.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 * <p>The <tt>ObjectName</tt> for uniquely identifying the MXBean for
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 * the operating system within an MBeanServer is:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 * <blockquote>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 *    {@link ManagementFactory#OPERATING_SYSTEM_MXBEAN_NAME
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 *      <tt>java.lang:type=OperatingSystem</tt>}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 * </blockquote>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 *
401
ef01e0dccd63 6610094: Add generic support for platform MXBeans of any type (also fixed 6681031)
mchung
parents: 2
diff changeset
    47
 * 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
    48
 * {@link PlatformManagedObject#getObjectName} method.
ef01e0dccd63 6610094: Add generic support for platform MXBeans of any type (also fixed 6681031)
mchung
parents: 2
diff changeset
    49
 *
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
 * <p> This interface defines several convenient methods for accessing
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
 * system properties about the operating system on which the Java
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
 * virtual machine is running.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
 *
401
ef01e0dccd63 6610094: Add generic support for platform MXBeans of any type (also fixed 6681031)
mchung
parents: 2
diff changeset
    54
 * @see ManagementFactory#getPlatformMXBeans(Class)
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
 * @see <a href="../../../javax/management/package-summary.html">
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
 *      JMX Specification.</a>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
 * @see <a href="package-summary.html#examples">
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
 *      Ways to Access MXBeans</a>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
 * @author  Mandy Chung
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
 * @since   1.5
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
 */
401
ef01e0dccd63 6610094: Add generic support for platform MXBeans of any type (also fixed 6681031)
mchung
parents: 2
diff changeset
    63
public interface OperatingSystemMXBean extends PlatformManagedObject {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
     * Returns the operating system name.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
     * This method is equivalent to <tt>System.getProperty("os.name")</tt>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
     * @return the operating system name.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
     * @throws  java.lang.SecurityException
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
     *     if a security manager exists and its
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
     *     <code>checkPropertiesAccess</code> method doesn't allow access
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
     *     to this system property.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
     * @see java.lang.SecurityManager#checkPropertyAccess(java.lang.String)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
     * @see java.lang.System#getProperty
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
    public String getName();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
     * Returns the operating system architecture.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
     * This method is equivalent to <tt>System.getProperty("os.arch")</tt>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
     * @return the operating system architecture.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
     * @throws  java.lang.SecurityException
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
     *     if a security manager exists and its
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
     *     <code>checkPropertiesAccess</code> method doesn't allow access
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
     *     to this system property.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
     * @see java.lang.SecurityManager#checkPropertyAccess(java.lang.String)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
     * @see java.lang.System#getProperty
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
    public String getArch();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
     * Returns the operating system version.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
     * This method is equivalent to <tt>System.getProperty("os.version")</tt>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
     * @return the operating system version.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
     * @throws  java.lang.SecurityException
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
     *     if a security manager exists and its
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
     *     <code>checkPropertiesAccess</code> method doesn't allow access
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
     *     to this system property.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
     * @see java.lang.SecurityManager#checkPropertyAccess(java.lang.String)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
     * @see java.lang.System#getProperty
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
    public String getVersion();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
     * Returns the number of processors available to the Java virtual machine.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
     * This method is equivalent to the {@link Runtime#availableProcessors()}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
     * method.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
     * <p> This value may change during a particular invocation of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
     * the virtual machine.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
     * @return  the number of processors available to the virtual
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
     *          machine; never smaller than one.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
    public int getAvailableProcessors();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
     * Returns the system load average for the last minute.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
     * The system load average is the sum of the number of runnable entities
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
     * queued to the {@linkplain #getAvailableProcessors available processors}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
     * and the number of runnable entities running on the available processors
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
     * averaged over a period of time.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
     * The way in which the load average is calculated is operating system
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
     * specific but is typically a damped time-dependent average.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
     * If the load average is not available, a negative value is returned.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
     * This method is designed to provide a hint about the system load
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
     * and may be queried frequently.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
     * The load average may be unavailable on some platform where it is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
     * expensive to implement this method.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
     * @return the system load average; or a negative value if not available.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
     * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
    public double getSystemLoadAverage();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
}