Class GarbageCollectionMonitor

All Implemented Interfaces:
DynamicMBean, MBeanRegistration, NotificationBroadcaster, NotificationEmitter, BaseObjectNamed, GarbageCollectionMonitorMBean, SelfEmailingMBean

public class GarbageCollectionMonitor extends SelfAwareMBean implements GarbageCollectionMonitorMBean, NotificationEmitter
Implementation of GarbageCollectionMonitorMBean.

This class is non-final so as to allow subclassing and overriding of getCurrentGCMillis().

Supported API: true

Extendable: true

  • Constructor Details

  • Method Details

    • getCurrentGCMillis

      protected long getCurrentGCMillis()
      Method which determines a metric for the total number of milliseconds spent in GC since application startup.

      This method is left as protected and the overall class as non-final to allow this method to be overriden since there are different ways one might compute this result given the sparsity of information provided by the underlying GarbageCollectorMXBeans and the goal of arriving at a metric which best gauges the impact garbage collection has on the application.

      This implementation considers only garbage collectors which operate upon the old or tenured generation as being significant -- as these garbage collectors generally pause other threads at times and generally present more of a bottleneck than other collectors which are often only a small drain on CPU time by comparison.

      Supported API: true