Interface GarbageCollectorMXBean

All Superinterfaces:
GarbageCollectorMXBean, MemoryManagerMXBean, MemoryManagerMXBean, PlatformManagedObject

public interface GarbageCollectorMXBean extends GarbageCollectorMXBean, MemoryManagerMXBean
Platform-specific management interface for a garbage collector which performs collections in cycles.

GarbageCollectorMXBean is an interface used by the management system to access garbage collector properties and reset the values of associated counter and accumulator properties.

This platform extension is only available to the garbage collection implementation that supports this extension.

Since:
1.5, 18
  • Method Details

    • getLastGcInfo

      GcInfo getLastGcInfo()
      Returns a GcInfo object that contains detailed information about the most recently completed garbage collection.

      Collector specific attributes, if any, can be obtained via the CompositeData interface.

      MBeanServer access: The mapped type of GcInfo is CompositeData with attributes specified in GcInfo.

      Returns:
      a GcInfo object representing the most recent GC information; or null if no GC information is available.
    • getRunningTimeNanos

      long getRunningTimeNanos()
      The total elapsed wall clock time in nanoseconds spent in collections completed by this collector since Java virtual machine launch. The value is updated after the first and each subsequent collection completes, and includes wall clock time spent running both concurrently and during required pauses. This method returns -1 if elapsed running time is undefined for this collector.

      This method is a convenience method whose value is equal to the the accumulated wall clock running time required by this collector between all calls to resetCumulativeStats, plus those that have occurred since the last such call. See getCumulativeRunningTimeNanos.

      Returns:
      the wall clock time spent in completed collections; or -1 if running time is undefined.
    • getPauseCount

      long getPauseCount()
      The total number of pauses required by this collector during collections completed by this collector since Java virtual machine launch. The value is updated after the first and each subsequent collection completes. This method returns -1 if the pause count is undefined for this collector.
      Returns:
      the total number of pauses required by this collector during collections run by this collector, or -1 if the pause count is undefined.
    • getPauseTimeNanos

      long getPauseTimeNanos()
      The total elapsed wall clock time in nanoseconds spent in all types of pauses required by this collector during collections completed by this collector since Java virtual machine launch. The value is updated after the first and each subsequent collection completes. This method returns -1 if elapsed pause time is undefined for this collector.

      This method may return a value more precise than returned by, and is usually functionally equivalent to, the imprecisely specified GarbageCollectorMXBean.getCollectionTime().

      This method is a convenience method whose value is equal to the the accumulated durations of all pauses required by this collector that have occurred between all calls to resetCumulativeStats, plus those that have occurred since the last such call. See getCumulativePauseTimeNanos.

      Returns:
      the elapsed pause time in nanoseconds; or -1 if pause time is undefined.
    • getCumulativeCollectionCount

      long getCumulativeCollectionCount()
      The number of collections completed by this collector since the last reset by resetCumulativeStats. This method returns -1 if cumulative statistics are not supported.
      Returns:
      this cumulative number of completed collections; or -1 if cumulative statistics are not supported.
    • getCumulativeRunningTimeNanos

      long getCumulativeRunningTimeNanos()
      The approximate cumulative wall clock time in nanoseconds spent in collections completed by this collector since the last reset by resetCumulativeStats. The value is updated after the first and each subsequent collection completes, and includes wall clock time spent running both concurrently and during required pauses. This method returns -1 if cumulative statistics are not supported.
      Returns:
      the cumulative wall clock time spent in completed collections; or -1 if cumulative statistics are not supported.
    • getCumulativePauseCount

      long getCumulativePauseCount()
      The number of pauses of all types required by this collector during its completed collections since the last reset by resetCumulativeStats. The value is updated after the first and each subsequent collection completes. This method returns -1 if cumulative statistics are not supported.
      Returns:
      the cumulative number of required pauses during completed collections; or -1 if cumulative statistics are not supported.
    • getCumulativePauseTimeNanos

      long getCumulativePauseTimeNanos()
      The approximate cumulative wall clock time in nanoseconds spent in all types of pauses required by this collector during collections completed by this collector since the last reset by resetCumulativeStats. The value is updated after the first and each subsequent collection completes, and is always less than or equal to the value returned by getCumulativeRunningTimeNanos. This method returns -1 if cumulative statistics are not supported.

      If resetCumulativeStats has not been called since Java virtual machine launch, this method may return a value more precise than returned by, and is usually functionally equivalent to, the imprecisely specified GarbageCollectorMXBean.getCollectionTime().

      Returns:
      the cumulative wall clock time spent in required pauses during completed collections; or -1 if cumulative statistics are not supported.
    • resetCumulativeStats

      long resetCumulativeStats()
      Reset to zero the cumulative values returned by getCumulativeCollectionCount, getCumulativeRunningTimeNanos, getCumulativePauseCount, getCumulativePauseTimeNanos, and return the time when the reset occured in nanoseconds since Java virtual machine launch. This method returns -1 if cumulative statistics are not supported.

      An implicit call to resetCumulativeStats with return value zero occurs when the Java virtual machine starts.

      Returns:
      the time when the reset occured in nanoseconds since Java virtual machine launch; -1 if cumulative statistics are not supported.
      Throws:
      SecurityException - if a security manager exists and the caller does not have ManagementPermission("control").
    • getLastResetCumulativeStatsTime

      long getLastResetCumulativeStatsTime()
      The time elapsed in nanoseconds between Java virtual machine launch and the most recent reset done by resetCumulativeStats. This method returns -1 if cumulative statistics are not supported. This is a convenience method that returns the value returned by the most recent call to resetCumulativeStats.

      An implicit call to resetCumulativeStats occurs when the Java virtual machine starts, so if the value returned by this method is zero, no user call to resetCumulativeStats has yet occurred.

      Returns:
      the elapsed time between Java virtual machine launch and the most recent reset; or -1 if cumulative statistics are not supported.
    • getGarbageCollectorThreadCount

      long getGarbageCollectorThreadCount()
      The number of garbage collection threads in the pool of garbage collection threads for this manager.
      Returns:
      the number of garbage collection threads in the pool of garbage collection threads for this manager.