src/share/classes/java/lang/management/BufferPoolMXBean.java

Print this page




   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package java.nio;
  27 
  28 import java.lang.management.PlatformManagedObject;
  29 
  30 /**
  31  * The management interface for a buffer pool.


  32  *
  33  * <p> A class implementing this interface is an <a href=
  34  * "java.lang.management.ManagementFactory.html#MXBean">MXBean</a>. A Java
  35  * virtual machine has one or more implementations of this interface. The {@link
  36  * java.lang.management.ManagementFactory#getPlatformMXBeans getPlatformMXBeans}
  37  * method can be used to obtain the list of {@code BufferPoolMXBean} objects
  38  * representing the management interfaces for pools of buffers as follows:
  39  * <pre>
  40  *     List&lt;BufferPoolMXBean&gt; pools = ManagementFactory.getPlatformMXBeans(BufferPoolMXBean.class);
  41  * </pre>
  42  *
  43  * <p> The management interfaces are also registered with the platform {@link
  44  * javax.management.MBeanServer MBeanServer}. The {@link
  45  * javax.management.ObjectName ObjectName} that uniquely identifies the
  46  * management interface within the {@code MBeanServer} takes the form:
  47  * <blockquote>
  48  *    <tt>java.nio:type=BufferPool</tt><tt>,name=</tt><i>pool name</i>
  49  * </blockquote>
  50  * where <em>pool name</em> is the {@link #getName name} of the buffer pool.
  51  *
  52  * @since   1.7
  53  */
  54 
  55 public interface BufferPoolMXBean extends PlatformManagedObject {
  56 
  57     /**
  58      * Returns the name representing this buffer pool.
  59      *
  60      * @return  The name of this buffer pool.
  61      */
  62     String getName();
  63 
  64     /**
  65      * Returns an estimate of the number of buffers in the pool.
  66      *
  67      * @return  An estimate of the number of buffers in this pool
  68      */
  69     long getCount();
  70 
  71     /**
  72      * Returns an estimate of the total capacity of the buffers in this pool.
  73      * A buffer's capacity is the number of elements it contains and the value
  74      * returned by this method is an estimate of the total capacity of buffers


   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package java.lang.management;
  27 


  28 /**
  29  * The management interface for a buffer pool, for example a pool of
  30  * {@link java.nio.ByteBuffer#allocateDirect direct} or {@link
  31  * java.nio.MappedByteBuffer mapped} buffers.
  32  *
  33  * <p> A class implementing this interface is an 
  34  * {@link javax.management.MXBean}. A Java
  35  * virtual machine has one or more implementations of this interface. The {@link
  36  * java.lang.management.ManagementFactory#getPlatformMXBeans getPlatformMXBeans}
  37  * method can be used to obtain the list of {@code BufferPoolMXBean} objects
  38  * representing the management interfaces for pools of buffers as follows:
  39  * <pre>
  40  *     List&lt;BufferPoolMXBean&gt; pools = ManagementFactory.getPlatformMXBeans(BufferPoolMXBean.class);
  41  * </pre>
  42  *
  43  * <p> The management interfaces are also registered with the platform {@link
  44  * javax.management.MBeanServer MBeanServer}. The {@link
  45  * javax.management.ObjectName ObjectName} that uniquely identifies the
  46  * management interface within the {@code MBeanServer} takes the form:
  47  * <pre>
  48  *     java.nio:type=BufferPool,name=<i>pool name</i>
  49  * </pre>
  50  * where <em>pool name</em> is the {@link #getName name} of the buffer pool.
  51  *
  52  * @since   1.7
  53  */

  54 public interface BufferPoolMXBean extends PlatformManagedObject {
  55 
  56     /**
  57      * Returns the name representing this buffer pool.
  58      *
  59      * @return  The name of this buffer pool.
  60      */
  61     String getName();
  62 
  63     /**
  64      * Returns an estimate of the number of buffers in the pool.
  65      *
  66      * @return  An estimate of the number of buffers in this pool
  67      */
  68     long getCount();
  69 
  70     /**
  71      * Returns an estimate of the total capacity of the buffers in this pool.
  72      * A buffer's capacity is the number of elements it contains and the value
  73      * returned by this method is an estimate of the total capacity of buffers