Path: blob/master/jcl/src/java.management/share/classes/java/lang/management/OperatingSystemMXBean.java
12511 views
/*[INCLUDE-IF JAVA_SPEC_VERSION >= 8]*/1/*2*******************************************************************************3* Copyright (c) 2005, 2022 IBM Corp. and others4*5* This program and the accompanying materials are made available under6* the terms of the Eclipse Public License 2.0 which accompanies this7* distribution and is available at https://www.eclipse.org/legal/epl-2.0/8* or the Apache License, Version 2.0 which accompanies this distribution and9* is available at https://www.apache.org/licenses/LICENSE-2.0.10*11* This Source Code may also be made available under the following12* Secondary Licenses when the conditions for such availability set13* forth in the Eclipse Public License, v. 2.0 are satisfied: GNU14* General Public License, version 2 with the GNU Classpath15* Exception [1] and GNU General Public License, version 2 with the16* OpenJDK Assembly Exception [2].17*18* [1] https://www.gnu.org/software/classpath/license.html19* [2] http://openjdk.java.net/legal/assembly-exception.html20*21* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 OR LicenseRef-GPL-2.0 WITH Assembly-exception22*******************************************************************************/23package java.lang.management;2425/**26* The management and monitoring interface for the operating system where the27* virtual machine is running.28* <p>29* Precisely one instance of this interface will be made available to management30* clients.31* </p>32* <p>33* Accessing this <code>MXBean</code> can be done in one of three ways.34* <ol>35* <li>Invoking the static ManagementFactory.getOperatingSystemMXBean() method.36* </li>37* <li>Using a javax.management.MBeanServerConnection.</li>38* <li>Obtaining a proxy MXBean from the static39* {@link ManagementFactory#newPlatformMXBeanProxy} method, passing in40* "java.lang:type=OperatingSystem" for the value of the second41* parameter.</li>42* </ol>43*44* @since 1.545*/46public interface OperatingSystemMXBean extends PlatformManagedObject {4748/**49* Returns a unique string identifier for the architecture of the underlying50* operating system. The identifier value is identical to that which would51* be obtained from a call to {@link System#getProperty(java.lang.String)}52* supplying the value "os.arch" for the key.53*54* @return the identifier for the operating system architecture.55* @throws SecurityException56* if there is a security manager in operation and the caller57* does not have permission to check system properties.58* @see System#getProperty(java.lang.String)59*/60public String getArch();6162/**63* Returns the number of processors that are available for the virtual64* machine to run on. The information returned from this method is identical65* to that which would be received from a call to66* {@link Runtime#availableProcessors()}.67*68* @return the number of available processors.69*/70public int getAvailableProcessors();7172/**73* Returns the name of the underlying operating system. The value is74* identical to that which would be obtained from a call to75* {@link System#getProperty(java.lang.String)} supplying the value76* "os.name" for the key.77*78* @return the name of the operating system.79* @throws SecurityException80* if there is a security manager in operation and the caller81* does not have permission to check system properties.82* @see System#getProperty(java.lang.String)83*/84public String getName();8586/**87* Returns the version string for the underlying operating system. The value88* is identical to that which would be obtained from a call to89* {@link System#getProperty(java.lang.String)} supplying the value90* "os.version" for the key.91*92* @return the version of the operating system.93* @throws SecurityException94* if there is a security manager in operation and the caller95* does not have permission to check system properties.96* @see System#getProperty(java.lang.String)97*/98public String getVersion();99100/**101* Returns a double value which holds the system load average calculated for102* the minute preceding the call, where <i>system load average</i> is taken103* to mean the following:104* <p>105* the time-averaged value of the sum of the number of runnable entities106* running on the available processors and the number of runnable entities107* ready and queued to run on the available processors. The averaging108* technique adopted can vary depending on the underlying operating system.109*110* @return normally, the system load average as a double. If the system load111* average is not obtainable (e.g. because the calculation may112* involve an unacceptable performance impact) then a negative value113* is returned.114* @since 1.6115*/116public double getSystemLoadAverage();117118}119120121