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