mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
Only count 1000 entities
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@2953 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -159,11 +159,22 @@ public class EhCacheTracerJob implements Job
|
||||
{
|
||||
// calculate the cache deep size - EHCache 1.1 is always returning 0L
|
||||
List<Serializable> keys = cache.getKeys();
|
||||
// only count a maximum of 1000 entities
|
||||
int count = 0;
|
||||
for (Serializable key : keys)
|
||||
{
|
||||
Element element = cache.get(key);
|
||||
size += getSize(element);
|
||||
count++;
|
||||
if (count >= 1000)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// the size must be multiplied by the ratio of the count to actual size
|
||||
size = count > 0L ? (long) (size * ((double)keys.size()/(double)count)) : 0L;
|
||||
|
||||
sizeMB = (double)size/1024.0/1024.0;
|
||||
maxSize = cache.getMaxElementsInMemory();
|
||||
currentSize = cache.getMemoryStoreSize();
|
||||
|
Reference in New Issue
Block a user