Skip to content
Browse files

Modified CacheBean to work with new cache fw.

  • Loading branch information...
1 parent 83338d7 commit 5d1670acb9f42b6fbd6166385dbbe0ce2459f609 Johan Svensson committed
View
4 management/src/main/java/org/neo4j/management/Cache.java
@@ -41,8 +41,8 @@
int getRelationshipCacheSize();
*/
- @Description( "The number of entities currently in this cache" )
- int getNumberOfCachedElements();
+ @Description( "The size of this cache (nr of entities or total size in bytes)" )
+ long getCacheSize();
@Description( "The number of times a cache query returned a result" )
long getHitCount();
View
8 management/src/main/java/org/neo4j/management/impl/CacheBean.java
@@ -45,7 +45,7 @@ public CacheBean()
{
NodeManager nm = management.getKernelData().graphDatabase().getNodeManager();
Collection<CacheManager> cacheBeans = new LinkedList<CacheBean.CacheManager>();
- for ( Cache<?, ?> cache : nm.caches() )
+ for ( Cache<?> cache : nm.caches() )
{
cacheBeans.add( new CacheManager( management, nm, cache ) );
}
@@ -60,10 +60,10 @@ protected Neo4jMBean createMBean( ManagementData management ) throws NotComplian
private class CacheManager extends Neo4jMBean implements org.neo4j.management.Cache
{
- private final Cache<?, ?> cache;
+ private final Cache<?> cache;
private final NodeManager nodeManager;
- CacheManager( ManagementData management, NodeManager nodeManager, Cache<?, ?> cache )
+ CacheManager( ManagementData management, NodeManager nodeManager, Cache<?> cache )
throws NotCompliantMBeanException
{
super( management, cache.getName() );
@@ -82,7 +82,7 @@ public void clear()
}
@Override
- public int getNumberOfCachedElements()
+ public long getCacheSize()
{
return cache.size();
}
View
2 management/src/test/java/org/neo4j/management/TestCacheBeans.java
@@ -94,7 +94,7 @@ private void assertChanged( String message, long[] before, long[] after )
@Override
long get( Cache bean )
{
- return bean.getNumberOfCachedElements();
+ return bean.getCacheSize();
}
},
HIT_COUNT

0 comments on commit 5d1670a

Please sign in to comment.
Something went wrong with that request. Please try again.