Class DefaultWatcher

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

public class DefaultWatcher extends Object implements IMemoryWatcher
The DefaultWatcher class implements the IMemoryWatcher interface and is responsible for monitoring memory usage of memory pools, specifically those that are of type HEAP and have names starting with "PS Survivor". It registers a notification listener to receive updates when the memory usage exceeds a specified threshold.
Since:
08.07.2017
  • Constructor Details

    • DefaultWatcher

      public DefaultWatcher()
  • 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, and its name starts with "PS Survivor".
      Specified by:
      isValid in interface IMemoryWatcher
      Parameters:
      pool - the MemoryPoolMXBean to validate
      Returns:
      true if the pool is valid for monitoring; false otherwise