String[] entityNames = statistics.getEntityNames();
Map<String, EntityCacheStatsWrapper> entityCacheStats = new HashMap<String, EntityCacheStatsWrapper>();
for (String entityName : entityNames) {
EntityStatistics entityStatistics = statistics.getEntityStatistics(entityName);
EntityCacheStatsWrapper entityCacheStatsWrapper = new EntityCacheStatsWrapper();
entityCacheStatsWrapper.setEntityStatsWrapper(new EntityStatsWrapper(entityName, entityStatistics));
entityCacheStats.put(entityName, entityCacheStatsWrapper);
}
for (String regionName : statistics.getSecondLevelCacheRegionNames()) {
CacheStatsWrapper cacheStatsWrapper = new CacheStatsWrapper(regionName, statistics.getSecondLevelCacheStatistics(regionName));
if(entityCacheStats.containsKey(regionName)){
EntityCacheStatsWrapper entityCacheStatsWrapper = entityCacheStats.get(regionName);
EntityCacheStatsWrapper entityStatsWrapper = entityCacheStatsWrapper;
entityStatsWrapper.setCacheStatsWrapper(cacheStatsWrapper);
}
else {
EntityCacheStatsWrapper entityCacheStatsWrapper = new EntityCacheStatsWrapper();
entityCacheStatsWrapper.setCacheStatsWrapper(cacheStatsWrapper);
entityCacheStats.put(regionName, entityCacheStatsWrapper);
}
}
result.include("entityCacheStats", entityCacheStats);