public class NotificationMemoryMonitor extends AbstractMemoryMonitor
NotificationMemoryMonitor
class uses the Java5
memory management system to detect system low memory events.
This code is loosely based on the code taken from The Java Specialists' Newsletter, issue 92 authored by Dr. Heinz M. Kabutz. As a note, his on-line newletters are a good source of Java information, take a look.
For more information one should review the Java5 classes in java.lang.management.
MemoryMonitor.Listener, MemoryMonitor.Test
Modifier and Type | Field and Description |
---|---|
protected static MemoryPoolMXBean |
TENURED_POOL |
Modifier and Type | Method and Description |
---|---|
protected org.apache.log4j.Logger |
getLogger()
Get the
Logger . |
long |
getMaxMemory()
Get the maximum possible memory usage for this JVM instance.
|
long |
getUsedMemory()
Get the current memory usage for this JVM instance.
|
protected void |
notifyNewLowThreshold(long newLowThreshold)
Notify the Java5 memory management system that there is a new
low threshold.
|
addListener, addListener, convertPercentageToThreshold, convertThresholdToPercentage, generateLowThreshold, getDefaultThresholdPercentage, getLowThreshold, notifyListeners, removeAllListener, removeListener, resetFromTest, updateListenerThreshold, usagePercentage
protected static final MemoryPoolMXBean TENURED_POOL
protected org.apache.log4j.Logger getLogger()
Logger
.getLogger
in class AbstractMemoryMonitor
Logger
.protected void notifyNewLowThreshold(long newLowThreshold)
notifyNewLowThreshold
in class AbstractMemoryMonitor
newLowThreshold
- the new threshold.public long getMaxMemory()
public long getUsedMemory()
Copyright © 2018 Hitachi Vantara. All rights reserved.