context.getFailureDescription().set(String.format("Unknown metric %s", attrName));
} else if (cache == null) {
context.getFailureDescription().set(String.format("Unavailable cache %s", attrName));
} else {
AdvancedCache<?, ?> aCache = cache.getAdvancedCache();
LockManagerImpl lockManager = (LockManagerImpl) SecurityActions.getLockManager(aCache);
RpcManagerImpl rpcManager = (RpcManagerImpl) SecurityActions.getRpcManager(aCache);
List<CommandInterceptor> interceptors = SecurityActions.getInterceptorChain(aCache);
ComponentRegistry registry = SecurityActions.getComponentRegistry(aCache);
ComponentStatus status = SecurityActions.getCacheStatus(aCache);
switch (metric) {
case CACHE_STATUS:
result.set(status.toString());
break;
case CONCURRENCY_LEVEL:
result.set(lockManager.getConcurrencyLevel());
break;
case NUMBER_OF_LOCKS_AVAILABLE:
result.set(lockManager.getNumberOfLocksAvailable());
break;
case NUMBER_OF_LOCKS_HELD:
result.set(lockManager.getNumberOfLocksHeld());
break;
case AVERAGE_READ_TIME: {
CacheMgmtInterceptor cacheMgmtInterceptor = getFirstInterceptorWhichExtends(interceptors, CacheMgmtInterceptor.class);
result.set(cacheMgmtInterceptor != null ? cacheMgmtInterceptor.getAverageReadTime() : 0);
break;