Path: blob/master/src/java.management/share/classes/java/lang/management/BufferPoolMXBean.java
41159 views
/*1* Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425package java.lang.management;2627/**28* The management interface for a buffer pool, for example a pool of29* {@link java.nio.ByteBuffer#allocateDirect direct} or {@link30* java.nio.MappedByteBuffer mapped} buffers.31*32* <p> A class implementing this interface is an33* {@link javax.management.MXBean}. A Java34* virtual machine has one or more implementations of this interface. The {@link35* java.lang.management.ManagementFactory#getPlatformMXBeans getPlatformMXBeans}36* method can be used to obtain the list of {@code BufferPoolMXBean} objects37* representing the management interfaces for pools of buffers as follows:38* <pre>39* List<BufferPoolMXBean> pools = ManagementFactory.getPlatformMXBeans(BufferPoolMXBean.class);40* </pre>41*42* <p> The management interfaces are also registered with the platform {@link43* javax.management.MBeanServer MBeanServer}. The {@link44* javax.management.ObjectName ObjectName} that uniquely identifies the45* management interface within the {@code MBeanServer} takes the form:46* <pre>47* java.nio:type=BufferPool,name=<i>pool name</i>48* </pre>49* where <em>pool name</em> is the {@link #getName name} of the buffer pool.50*51* @since 1.752*/53public interface BufferPoolMXBean extends PlatformManagedObject {5455/**56* Returns the name representing this buffer pool.57*58* @return The name of this buffer pool.59*/60String getName();6162/**63* Returns an estimate of the number of buffers in the pool.64*65* @return An estimate of the number of buffers in this pool66*/67long getCount();6869/**70* Returns an estimate of the total capacity of the buffers in this pool.71* A buffer's capacity is the number of elements it contains and the value72* returned by this method is an estimate of the total capacity of buffers73* in the pool in bytes.74*75* @return An estimate of the total capacity of the buffers in this pool76* in bytes77*/78long getTotalCapacity();7980/**81* Returns an estimate of the memory that the Java virtual machine is using82* for this buffer pool. The value returned by this method may differ83* from the estimate of the total {@link #getTotalCapacity capacity} of84* the buffers in this pool. This difference is explained by alignment,85* memory allocator, and other implementation specific reasons.86*87* @return An estimate of the memory that the Java virtual machine is using88* for this buffer pool in bytes, or {@code -1L} if an estimate of89* the memory usage is not available90*/91long getMemoryUsed();92}939495