java.lang.Object
host.anzo.commons.emergency.memory.watchers.G1Watcher
All Implemented Interfaces:
IMemoryWatcher

public class G1Watcher extends Object implements IMemoryWatcher
The G1Watcher class implements the IMemoryWatcher interface and is responsible for monitoring the memory usage of G1 garbage collector memory pools. It registers a notification listener to receive updates when the memory usage exceeds a specified threshold.
Since:
08.07.2017
  • Constructor Details

    • G1Watcher

      public G1Watcher()
  • Method Details

    • register

      public void register(MemoryPoolMXBean pool)
      Registers the specified MemoryPoolMXBean for monitoring. It sets the usage threshold to 85% of the maximum usage and adds a notification listener to listen for memory usage notifications.
      Specified by:
      register in interface IMemoryWatcher
      Parameters:
      pool - the MemoryPoolMXBean to register for monitoring
    • isValid

      public boolean isValid(MemoryPoolMXBean pool)
      Validates whether the specified MemoryPoolMXBean is suitable for monitoring. A pool is considered valid if it is of type HEAP, supports usage thresholds, supports collection usage thresholds, and its name starts with "G1".
      Specified by:
      isValid in interface IMemoryWatcher
      Parameters:
      pool - the MemoryPoolMXBean to validate
      Returns:
      true if the pool is valid for monitoring; false otherwise