mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
Fixed handling of Infinity
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@2949 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -81,7 +81,7 @@ public class EhCacheTracerJob implements Job
|
|||||||
}
|
}
|
||||||
|
|
||||||
long maxHeapSize = Runtime.getRuntime().maxMemory();
|
long maxHeapSize = Runtime.getRuntime().maxMemory();
|
||||||
long totalSize = 0L;
|
long allCachesTotalSize = 0L;
|
||||||
double estimatedMaxSize = 0L;
|
double estimatedMaxSize = 0L;
|
||||||
// get all the caches
|
// get all the caches
|
||||||
String[] cacheNames = cacheManager.getCacheNames();
|
String[] cacheNames = cacheManager.getCacheNames();
|
||||||
@@ -97,16 +97,19 @@ public class EhCacheTracerJob implements Job
|
|||||||
CacheAnalysis analysis = new CacheAnalysis(cache);
|
CacheAnalysis analysis = new CacheAnalysis(cache);
|
||||||
logger.debug(analysis);
|
logger.debug(analysis);
|
||||||
// get the size
|
// get the size
|
||||||
totalSize += analysis.getSize();
|
allCachesTotalSize += analysis.getSize();
|
||||||
estimatedMaxSize += Double.isNaN(analysis.getEstimatedMaxSize()) ? 0.0 : analysis.getEstimatedMaxSize();
|
double cacheEstimatedMaxSize = analysis.getEstimatedMaxSize();
|
||||||
|
estimatedMaxSize += (Double.isNaN(cacheEstimatedMaxSize) || Double.isInfinite(cacheEstimatedMaxSize))
|
||||||
|
? 0.0
|
||||||
|
: cacheEstimatedMaxSize;
|
||||||
}
|
}
|
||||||
// check the size
|
// check the size
|
||||||
double sizePercentage = (double)totalSize / (double)maxHeapSize * 100.0;
|
double sizePercentage = (double)allCachesTotalSize / (double)maxHeapSize * 100.0;
|
||||||
double maxSizePercentage = estimatedMaxSize / (double)maxHeapSize * 100.0;
|
double maxSizePercentage = estimatedMaxSize / (double)maxHeapSize * 100.0;
|
||||||
String msg = String.format(
|
String msg = String.format(
|
||||||
"EHCaches currently consume %5.2f MB or %3.2f percent of system VM size. \n" +
|
"EHCaches currently consume %5.2f MB or %3.2f percent of system VM size. \n" +
|
||||||
"The estimated maximum size is %5.2f MB or %3.2f percent of system VM size.",
|
"The estimated maximum size is %5.2f MB or %3.2f percent of system VM size.",
|
||||||
(double)totalSize / 1024.0 / 1024.0,
|
(double)allCachesTotalSize / 1024.0 / 1024.0,
|
||||||
sizePercentage,
|
sizePercentage,
|
||||||
estimatedMaxSize / 1024.0 / 1024.0,
|
estimatedMaxSize / 1024.0 / 1024.0,
|
||||||
maxSizePercentage);
|
maxSizePercentage);
|
||||||
|
Reference in New Issue
Block a user