new interface method ObjectCache.getStatistics
the statistics of a cache instance for an application can be retrieved by calling `app.__app__.getCacheStatistics()`. That's not very useful for the default `ObjectCache` but essential for looking into what more complex cache impls like `SwarmCache` do we could remove all the other cache statistics methods like `getCacheUsage` and output that info in the map returned by `getCacheStatistics()` i had to bump java to 1.5 for the generics.. if that's a problem we can remove the generics
This commit is contained in:
parent
fd0b77bc11
commit
826987d3a2
5 changed files with 54 additions and 30 deletions
|
@ -102,8 +102,8 @@
|
||||||
<replace file="${build.work}/src/helma/main/Server.java"
|
<replace file="${build.work}/src/helma/main/Server.java"
|
||||||
token="__builddate__" value="${TODAY}"/>
|
token="__builddate__" value="${TODAY}"/>
|
||||||
<javac srcdir="${build.work}/src"
|
<javac srcdir="${build.work}/src"
|
||||||
source="1.4"
|
source="1.5"
|
||||||
target="1.4"
|
target="1.5"
|
||||||
destdir="${build.classes}"
|
destdir="${build.classes}"
|
||||||
debug="${debug}"
|
debug="${debug}"
|
||||||
deprecation="${deprecation}"
|
deprecation="${deprecation}"
|
||||||
|
|
|
@ -834,6 +834,13 @@ public final class Application implements Runnable {
|
||||||
return nmgr.countCacheEntries();
|
return nmgr.countCacheEntries();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a map of cache statistics
|
||||||
|
*/
|
||||||
|
public Map getCacheStatistics() {
|
||||||
|
return nmgr.getCacheStatistics();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the application's root element to an arbitrary object. After this is called
|
* Set the application's root element to an arbitrary object. After this is called
|
||||||
* with a non-null object, the helma node manager will be bypassed. This function
|
* with a non-null object, the helma node manager will be bypassed. This function
|
||||||
|
|
|
@ -110,4 +110,8 @@ public interface ObjectCache {
|
||||||
*/
|
*/
|
||||||
Object[] getCachedObjects();
|
Object[] getCachedObjects();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a map of statistics about the cache
|
||||||
|
*/
|
||||||
|
java.util.Map<String,Object> getStatistics();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1718,6 +1718,13 @@ public final class NodeManager {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a map with statistics about the cache
|
||||||
|
*/
|
||||||
|
public Map getCacheStatistics() {
|
||||||
|
return cache.getStatistics();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a listener that is notified each time a transaction commits
|
* Add a listener that is notified each time a transaction commits
|
||||||
* that adds, modifies or deletes any Nodes.
|
* that adds, modifies or deletes any Nodes.
|
||||||
|
|
|
@ -331,6 +331,12 @@ public class CacheMap implements ObjectCache {
|
||||||
return new HashMap(capacity, loadFactor);
|
return new HashMap(capacity, loadFactor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Map<String,Object> getStatistics() {
|
||||||
|
Map<String,Object> stats = new HashMap<String,Object>();
|
||||||
|
stats.put("size", size());
|
||||||
|
stats.put("threshold", threshold);
|
||||||
|
return stats;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue