- All Superinterfaces:
GarbageCollectorMXBean
,MemoryManagerMXBean
,MemoryManagerMXBean
,PlatformManagedObject
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 Summary
Modifier and TypeMethodDescriptionlong
The number of collections completed by this collector since the last reset byresetCumulativeStats
.long
The number of pauses of all types required by this collector during its completed collections since the last reset byresetCumulativeStats
.long
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 byresetCumulativeStats
.long
The approximate cumulative wall clock time in nanoseconds spent in collections completed by this collector since the last reset byresetCumulativeStats
.long
The number of garbage collection threads in the pool of garbage collection threads for this manager.Returns aGcInfo
object that contains detailed information about the most recently completed garbage collection.long
The time elapsed in nanoseconds between Java virtual machine launch and the most recent reset done byresetCumulativeStats
.long
The total number of pauses required by this collector during collections completed by this collector since Java virtual machine launch.long
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.long
The total elapsed wall clock time in nanoseconds spent in collections completed by this collector since Java virtual machine launch.long
Reset to zero the cumulative values returned bygetCumulativeCollectionCount
,getCumulativeRunningTimeNanos
,getCumulativePauseCount
,getCumulativePauseTimeNanos
, and return the time when the reset occured in nanoseconds since Java virtual machine launch.Methods declared in interface java.lang.management.GarbageCollectorMXBean
getCollectionCount, getCollectionTime
Methods declared in interface com.sun.management.MemoryManagerMXBean
getVersion, isValid
Methods declared in interface java.lang.management.MemoryManagerMXBean
getMemoryPoolNames, getName
Methods declared in interface java.lang.management.PlatformManagedObject
getObjectName
-
Method Details
-
getLastGcInfo
GcInfo getLastGcInfo()Returns aGcInfo
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
isCompositeData
with attributes specified inGcInfo
.- Returns:
- a
GcInfo
object representing the most recent GC information; ornull
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. SeegetCumulativeRunningTimeNanos
.- 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. SeegetCumulativePauseTimeNanos
.- 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 byresetCumulativeStats
. 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 byresetCumulativeStats
. 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 byresetCumulativeStats
. 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 byresetCumulativeStats
. The value is updated after the first and each subsequent collection completes, and is always less than or equal to the value returned bygetCumulativeRunningTimeNanos
. 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 specifiedGarbageCollectorMXBean.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 bygetCumulativeCollectionCount
,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 byresetCumulativeStats
. 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 toresetCumulativeStats
.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 toresetCumulativeStats
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.
-