KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > mondrian > util > FauxMemoryMonitor


1 /*
2 // $Id: //open/mondrian/src/main/mondrian/util/FauxMemoryMonitor.java#4 $
3 // This software is subject to the terms of the Common Public License
4 // Agreement, available at the following URL:
5 // http://www.opensource.org/licenses/cpl.html.
6 // Copyright (C) 2007-2007 Julian Hyde and others
7 // All Rights Reserved.
8 // You must accept the terms of that agreement to use this software.
9 */

10 package mondrian.util;
11
12 /**
13  * The <code>FauxMemoryMonitor</code> implements the <code>MemoryMonitor</code>
14  * interface but does nothing: all methods are empty.
15  *
16  * @author <a>Richard M. Emberson</a>
17  * @since Feb 03 2007
18  * @version $Id: //open/mondrian/src/main/mondrian/util/FauxMemoryMonitor.java#4 $
19  */

20 public class FauxMemoryMonitor implements MemoryMonitor {
21     FauxMemoryMonitor() {
22     }
23
24     public boolean addListener(Listener listener, int thresholdPercentage) {
25         return true;
26     }
27
28     public boolean addListener(final Listener listener) {
29         return true;
30     }
31
32     public void updateListenerThreshold(Listener listener, int percentage) {
33         // empty
34
}
35
36     public boolean removeListener(Listener listener) {
37         return true;
38     }
39     public void removeAllListener() {
40         // empty
41
}
42     public long getMaxMemory() {
43         return Runtime.getRuntime().maxMemory();
44     }
45     public long getUsedMemory() {
46         return Runtime.getRuntime().freeMemory();
47     }
48 }
49
50 // End FauxMemoryMonitor.java
51
Popular Tags