use of org.cache2k.core.InternalCache in project cache2k by cache2k.
the class JmxSupport method cacheCreated.
@Override
public void cacheCreated(Cache c) {
InternalCache ic = (InternalCache) c;
if (!ic.getCommonMetrics().isDisabled()) {
MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
String _name = standardName(c.getCacheManager(), c);
try {
mbs.registerMBean(new CacheMXBeanImpl(ic), new ObjectName(_name));
} catch (InstanceAlreadyExistsException ignore) {
log.debug("register failure, cache: " + c.getName(), ignore);
} catch (Exception e) {
throw new CacheException("register JMX bean, ObjectName: " + _name, e);
}
}
}
use of org.cache2k.core.InternalCache in project cache2k by cache2k.
the class BasicCacheOperationsTest method getEntryState.
@Test
public void getEntryState() {
if (!(cache instanceof InternalCache)) {
return;
}
InternalCache c = (InternalCache) cache;
String s = c.getEntryState(KEY);
assertNull(s);
cache.put(KEY, VALUE);
s = c.getEntryState(KEY);
assertNotNull(s);
}
use of org.cache2k.core.InternalCache in project cache2k by cache2k.
the class BasicCacheOperationsTest method getEntryState_Exception.
@Test
public void getEntryState_Exception() {
if (!(cache instanceof InternalCache)) {
return;
}
((Cache) cache).put(KEY, new ExceptionWrapper(OUCH));
InternalCache c = (InternalCache) cache;
String s = c.getEntryState(KEY);
assertTrue(s.contains("exception="));
}
use of org.cache2k.core.InternalCache in project cache2k by cache2k.
the class ManagerMXBeanImpl method getHealthStatus.
@Override
public String getHealthStatus() {
List<HealthInfoElement> li = new ArrayList<HealthInfoElement>();
for (Cache c : manager.getActiveCaches()) {
InternalCache ic = (InternalCache) c;
li.addAll(ic.getInfo().getHealth());
}
sortHealthInfoList(li);
return constructHealthString(li);
}
Aggregations