mondrian.util
Class NotificationMemoryMonitor

java.lang.Object
  extended by mondrian.util.AbstractMemoryMonitor
      extended by mondrian.util.NotificationMemoryMonitor
All Implemented Interfaces:
MemoryMonitor, MemoryMonitor.Test

public class NotificationMemoryMonitor
extends AbstractMemoryMonitor

The 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.

Since:
Feb 03 2007
Author:
Richard M. Emberson
 

Nested Class Summary
 
Nested classes/interfaces inherited from class mondrian.util.AbstractMemoryMonitor
AbstractMemoryMonitor.Entry
 
Nested classes/interfaces inherited from interface mondrian.util.MemoryMonitor
MemoryMonitor.Listener, MemoryMonitor.Test
 
Field Summary
protected static MemoryPoolMXBean TENURED_POOL
           
 
Constructor Summary
NotificationMemoryMonitor()
          Construct a NotificationMemoryMonitor instance and register it with the Java5 memory management system.
 
Method Summary
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.
 
Methods inherited from class mondrian.util.AbstractMemoryMonitor
addListener, addListener, convertPercentageToThreshold, convertThresholdToPercentage, generateLowThreshold, getDefaultThresholdPercentage, getLowThreshold, notifyListeners, removeAllListener, removeListener, resetFromTest, updateListenerThreshold, usagePercentage
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TENURED_POOL

protected static final MemoryPoolMXBean TENURED_POOL
Constructor Detail

NotificationMemoryMonitor

NotificationMemoryMonitor()
Construct a NotificationMemoryMonitor instance and register it with the Java5 memory management system.

Method Detail

getLogger

protected org.apache.log4j.Logger getLogger()
Get the Logger.

Specified by:
getLogger in class AbstractMemoryMonitor
Returns:
the Logger.

notifyNewLowThreshold

protected void notifyNewLowThreshold(long newLowThreshold)
Notify the Java5 memory management system that there is a new low threshold.

Overrides:
notifyNewLowThreshold in class AbstractMemoryMonitor
Parameters:
newLowThreshold - the new threshold.

getMaxMemory

public long getMaxMemory()
Get the maximum possible memory usage for this JVM instance.

Returns:
maximum memory that can be used.

getUsedMemory

public long getUsedMemory()
Get the current memory usage for this JVM instance.

Returns:
current memory used.

SourceForge.net_Logo