1 /* 2 * @(#)GarbageCollectorMXBean.java 1.9 04/04/20 3 * 4 * Copyright 2004 Sun Microsystems, Inc. All rights reserved. 5 * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. 6 */ 7 8 package java.lang.management; 9 10 /** 11 * The management interface for the garbage collection of 12 * the Java virtual machine. Garbage collection is the process 13 * that the Java virtual machine uses to find and reclaim unreachable 14 * objects to free up memory space. A garbage collector is one type of 15 * {@link MemoryManagerMXBean memory manager}. 16 * 17 * <p> A Java virtual machine may have one or more instances of 18 * the implementation class of this interface. 19 * An instance implementing this interface is 20 * an <a HREF="ManagementFactory.html#MXBean">MXBean</a> 21 * that can be obtained by calling 22 * the {@link ManagementFactory#getGarbageCollectorMXBeans} method or 23 * from the {@link ManagementFactory#getPlatformMBeanServer 24 * platform <tt>MBeanServer</tt>} method. 25 * 26 * <p>The <tt>ObjectName</tt> for uniquely identifying the MXBean for 27 * a garbage collector within an MBeanServer is: 28 * <blockquote> 29 * {@link ManagementFactory#GARBAGE_COLLECTOR_MXBEAN_DOMAIN_TYPE 30 * <tt>java.lang:type=GarbageCollector</tt>}<tt>,name=</tt><i>collector's name</i> 31 * </blockquote> 32 * 33 * A platform usually includes additional platform-dependent information 34 * specific to a garbage collection algorithm for monitoring. 35 * 36 * @see MemoryMXBean 37 * 38 * @see <a HREF="../../../javax/management/package-summary.html"> 39 * JMX Specification.</a> 40 * @see <a HREF="package-summary.html#examples"> 41 * Ways to Access MXBeans</a> 42 * 43 * @author Mandy Chung 44 * @version 1.9, 04/20/04 45 * @since 1.5 46 */ 47 public interface GarbageCollectorMXBean extends MemoryManagerMXBean { 48 /** 49 * Returns the total number of collections that have occurred. 50 * This method returns <tt>-1</tt> if the collection count is undefined for 51 * this collector. 52 * 53 * @return the total number of collections that have occurred. 54 */ 55 public long getCollectionCount(); 56 57 /** 58 * Returns the approximate accumulated collection elapsed time 59 * in milliseconds. This method returns <tt>-1</tt> if the collection 60 * elapsed time is undefined for this collector. 61 * <p> 62 * The Java virtual machine implementation may use a high resolution 63 * timer to measure the elapsed time. This method may return the 64 * same value even if the collection count has been incremented 65 * if the collection elapsed time is very short. 66 * 67 * @return the approximate accumulated collection elapsed time 68 * in milliseconds. 69 */ 70 public long getCollectionTime(); 71 72 73 } 74 75