001/*
002// This software is subject to the terms of the Eclipse Public License v1.0
003// Agreement, available at the following URL:
004// http://www.eclipse.org/legal/epl-v10.html.
005// You must accept the terms of that agreement to use this software.
006//
007// Copyright (C) 2007-2007 Pentaho and others
008// All Rights Reserved.
009*/
010package 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 */
019public class FauxMemoryMonitor implements MemoryMonitor {
020    FauxMemoryMonitor() {
021    }
022
023    public boolean addListener(Listener listener, int thresholdPercentage) {
024        return true;
025    }
026
027    public boolean addListener(final Listener listener) {
028        return true;
029    }
030
031    public void updateListenerThreshold(Listener listener, int percentage) {
032        // empty
033    }
034
035    public boolean removeListener(Listener listener) {
036        return true;
037    }
038    public void removeAllListener() {
039        // empty
040    }
041    public long getMaxMemory() {
042        return Runtime.getRuntime().maxMemory();
043    }
044    public long getUsedMemory() {
045        return Runtime.getRuntime().freeMemory();
046    }
047}
048
049// End FauxMemoryMonitor.java