use of com.adobe.acs.commons.util.impl.exception.CacheMBeanException in project acs-aem-commons by Adobe-Consulting-Services.
the class AbstractCacheMBean method getCacheContents.
@Override
public final TabularData getCacheContents() throws CacheMBeanException {
try {
final CompositeType cacheEntryType = getCacheEntryType();
final TabularDataSupport tabularData = new TabularDataSupport(new TabularType("Cache Entries", "Cache Entries", cacheEntryType, new String[] { JMX_PN_CACHEKEY }));
Map<K, V> cacheAsMap = getCacheAsMap();
for (final Map.Entry<K, V> entry : cacheAsMap.entrySet()) {
final Map<String, Object> data = new HashMap<String, Object>();
data.put(JMX_PN_CACHEKEY, entry.getKey().toString());
V cacheObj = entry.getValue();
if (cacheObj != null) {
addCacheData(data, cacheObj);
}
tabularData.put(new CompositeDataSupport(cacheEntryType, data));
}
return tabularData;
} catch (OpenDataException ex) {
throw new CacheMBeanException("Error getting the cache contents", ex);
}
}
Aggregations