001    /*
002    // $Id: //open/mondrian/src/main/mondrian/util/FauxMemoryMonitor.java#4 $
003    // This software is subject to the terms of the Common Public License
004    // Agreement, available at the following URL:
005    // http://www.opensource.org/licenses/cpl.html.
006    // Copyright (C) 2007-2007 Julian Hyde and others
007    // All Rights Reserved.
008    // You must accept the terms of that agreement to use this software.
009    */
010    package mondrian.util;
011    
012    /**
013     * The <code>FauxMemoryMonitor</code> implements the <code>MemoryMonitor</code>
014     * interface but does nothing: all methods are empty.
015     *
016     * @author <a>Richard M. Emberson</a>
017     * @since Feb 03 2007
018     * @version $Id: //open/mondrian/src/main/mondrian/util/FauxMemoryMonitor.java#4 $
019     */
020    public class FauxMemoryMonitor implements MemoryMonitor {
021        FauxMemoryMonitor() {
022        }
023    
024        public boolean addListener(Listener listener, int thresholdPercentage) {
025            return true;
026        }
027    
028        public boolean addListener(final Listener listener) {
029            return true;
030        }
031    
032        public void updateListenerThreshold(Listener listener, int percentage) {
033            // empty
034        }
035    
036        public boolean removeListener(Listener listener) {
037            return true;
038        }
039        public void removeAllListener() {
040            // empty
041        }
042        public long getMaxMemory() {
043            return Runtime.getRuntime().maxMemory();
044        }
045        public long getUsedMemory() {
046            return Runtime.getRuntime().freeMemory();
047        }
048    }
049    
050    // End FauxMemoryMonitor.java