Class G1Watcher
java.lang.Object
host.anzo.commons.emergency.memory.watchers.G1Watcher
- All Implemented Interfaces:
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 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
-
G1Watcher
public G1Watcher()
-
-
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, supports collection usage thresholds, and its name starts with "G1".- Specified by:
isValidin interfaceIMemoryWatcher- Parameters:
pool- the MemoryPoolMXBean to validate- Returns:
- true if the pool is valid for monitoring; false otherwise
-