Class DefaultWatcher
java.lang.Object
host.anzo.commons.emergency.memory.watchers.DefaultWatcher
- All Implemented Interfaces:
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanisValid(MemoryPoolMXBean pool) Validates whether the specified MemoryPoolMXBean is suitable for monitoring.voidregister(MemoryPoolMXBean pool) Registers the specified MemoryPoolMXBean for monitoring.
-
Constructor Details
-
DefaultWatcher
public DefaultWatcher()
-
-
Method Details
-
register
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:
registerin interfaceIMemoryWatcher- Parameters:
pool- the MemoryPoolMXBean to register for monitoring
-
isValid
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:
isValidin interfaceIMemoryWatcher- Parameters:
pool- the MemoryPoolMXBean to validate- Returns:
- true if the pool is valid for monitoring; false otherwise
-