- All Superinterfaces:
MemoryManagerMXBean
,PlatformManagedObject
- All Known Subinterfaces:
GarbageCollectorMXBean
,GarbageCollectorMXBean
The interface for managing and monitoring the virtual machine's garbage
collection functionality.
Multiple instances of this interface are available to clients. Each may be
distinguished by their separate ObjectName
value.
Accessing this kind of MXBean
can be done in one of three
ways.
- Invoking the static
ManagementFactory.getGarbageCollectorMXBeans()
method which returns aList
of all currently instantiated GarbageCollectorMXBeans. - Using a
MBeanServerConnection
. - Obtaining a proxy MXBean from the static
ManagementFactory.newPlatformMXBeanProxy(javax.management.MBeanServerConnection, java.lang.String, java.lang.Class<T>)
method, passing in the string "java.lang:type=GarbageCollector,name= unique collector's name " for the value of the second parameter.
- Since:
- 1.5
-
Method Summary
Modifier and TypeMethodDescriptionlong
Returns in a long the number of garbage collections carried out by the associated collector.long
For the associated garbage collector, returns the total amount of time in milliseconds that it has spent carrying out garbage collection.Methods declared in interface java.lang.management.MemoryManagerMXBean
getMemoryPoolNames, getName, isValid
Methods declared in interface java.lang.management.PlatformManagedObject
getObjectName
-
Method Details
-
getCollectionCount
long getCollectionCount()Returns in a long the number of garbage collections carried out by the associated collector.- Returns:
- the total number of garbage collections that have been carried out by the associated garbage collector.
-
getCollectionTime
long getCollectionTime()For the associated garbage collector, returns the total amount of time in milliseconds that it has spent carrying out garbage collection.- Returns:
- the number of milliseconds that have been spent in performing garbage collection. This is a cumulative figure.
-