Name

GarbageCollectorMXBean

Synopsis

This MXBean interface allows monitoring of the number of garbage collections that have occurred and the approximate time they consumed in milliseconds. The methods return -1 to indicate that the garbage collector does not maintain those statistics. Note that VM implementations commonly have more than one garbage collector and use different collection strategies for new objects and old objects. Note also that this is a subinterface of MemoryManagerMXBean.

java.lang.management.GarbageCollectorMXBean

Figure 10-85. java.lang.management.GarbageCollectorMXBean

public interface GarbageCollectorMXBean extends MemoryManagerMXBean {
// Public Instance Methods
     long getCollectionCount( );  
     long getCollectionTime( );  
}

Get Java in a Nutshell, 5th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.