Class GarbageCollectionMonitor

  • All Implemented Interfaces:
    java.lang.Runnable, java.util.EventListener, javax.management.NotificationListener

    public class GarbageCollectionMonitor
    extends java.lang.Object
    implements javax.management.NotificationListener, java.lang.Runnable
    Garbage collection monitor which records all GC pause lengths and logs them. In case the GC pause statistics are considered bad for latency, the statistics are logged at a warning level.
    • Constructor Summary

      Constructors 
      Constructor Description
      GarbageCollectionMonitor​(java.util.concurrent.ScheduledExecutorService reportingExecutor)
      Create an instance of GC monitor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void disable()
      Disable GC monitoring and reporting.
      void enable()
      Enable GC monitoring and reporting.
      void handleNotification​(javax.management.Notification notification, java.lang.Object handback)  
      void run()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • GarbageCollectionMonitor

        public GarbageCollectionMonitor​(java.util.concurrent.ScheduledExecutorService reportingExecutor)
        Create an instance of GC monitor. Does nothing until enabled.
        Parameters:
        reportingExecutor - Executor to use for scheduling reporting task
    • Method Detail

      • enable

        public void enable()
        Enable GC monitoring and reporting.
      • disable

        public void disable()
        Disable GC monitoring and reporting.
      • handleNotification

        public void handleNotification​(javax.management.Notification notification,
                                       java.lang.Object handback)
        Specified by:
        handleNotification in interface javax.management.NotificationListener
      • run

        public void run()
        Specified by:
        run in interface java.lang.Runnable