Class FauxMemoryMonitor
- All Implemented Interfaces:
MemoryMonitor
FauxMemoryMonitor implements the MemoryMonitor
interface but does nothing: all methods are empty.- Since:
- Feb 03 2007
- Author:
- Richard M. Emberson
-
Nested Class Summary
Nested classes/interfaces inherited from interface mondrian.util.MemoryMonitor
MemoryMonitor.Listener, MemoryMonitor.Test -
Method Summary
Modifier and TypeMethodDescriptionbooleanaddListener(MemoryMonitor.Listener listener) Adds aListenerusing the default threshold percentage.booleanaddListener(MemoryMonitor.Listener listener, int thresholdPercentage) Adds aListenerto theMemoryMonitorwith a given threshold percentage.longReturns the maximum memory usage.longReturns the current memory used.voidClear out allListeners and turnoff JVM memory notification.booleanremoveListener(MemoryMonitor.Listener listener) Removes aListenerfrom theMemoryMonitor.voidupdateListenerThreshold(MemoryMonitor.Listener listener, int percentage) Changes the threshold percentage of a givenListener.
-
Method Details
-
addListener
Description copied from interface:MemoryMonitorAdds aListenerto theMemoryMonitorwith a given threshold percentage.If the threshold is below the Java5 memory managment system's threshold, then the Listener is notified from within this method.
- Specified by:
addListenerin interfaceMemoryMonitor- Parameters:
listener- theListenerto be added.thresholdPercentage- the threshold percentage for thisListener.- Returns:
trueif theListenerwas added andfalseotherwise.
-
addListener
Description copied from interface:MemoryMonitorAdds aListenerusing the default threshold percentage.If the threshold is below the Java5 memory managment system's threshold, then the Listener is notified from within this method.
- Specified by:
addListenerin interfaceMemoryMonitor- Parameters:
listener- theListenerto be added.- Returns:
trueif theListenerwas added andfalseotherwise.
-
updateListenerThreshold
Description copied from interface:MemoryMonitorChanges the threshold percentage of a givenListener.If the new value is below the system's current value, then the
Listenerwill have its notification callback called while in this method - so a client should always check if its notification method was called immediately after calling this method.This method can be used if, for example, an algorithm has different approaches that result in different memory usage profiles; one, large memory but fast and a second which is low-memory but slow. The algorithm starts with the large memory approach, receives a low memory notification, switches to the low memory approach and changes when it should be notified for this new approach. The first approach need to be notified at a lower percentage because it uses lots of memory, possibly quickly; while the second approach, possibly a file based algorithm, has smaller memory requirements and uses memory less quickly thus one can live with a higher notification threshold percentage.
- Specified by:
updateListenerThresholdin interfaceMemoryMonitor- Parameters:
listener- theListenerbeing updated.percentage- new percentage threshold.
-
removeListener
Description copied from interface:MemoryMonitorRemoves aListenerfrom theMemoryMonitor. Returnstrueif listener was removed andfalseotherwise.- Specified by:
removeListenerin interfaceMemoryMonitor- Parameters:
listener- the listener to be removed- Returns:
trueif listener was removed.
-
removeAllListener
public void removeAllListener()Description copied from interface:MemoryMonitorClear out allListeners and turnoff JVM memory notification.- Specified by:
removeAllListenerin interfaceMemoryMonitor
-
getMaxMemory
public long getMaxMemory()Description copied from interface:MemoryMonitorReturns the maximum memory usage.- Specified by:
getMaxMemoryin interfaceMemoryMonitor- Returns:
- the maximum memory usage.
-
getUsedMemory
public long getUsedMemory()Description copied from interface:MemoryMonitorReturns the current memory used.- Specified by:
getUsedMemoryin interfaceMemoryMonitor- Returns:
- the current memory used.
-