use of org.cache2k.core.HealthInfoElement in project cache2k by cache2k.
the class CacheMXBeanImpl method getAlert.
@Override
public int getAlert() {
Iterator<HealthInfoElement> it = getInfo().getHealth().iterator();
if (!it.hasNext()) {
return 0;
}
HealthInfoElement hi = it.next();
if (HealthInfoElement.FAILURE.equals(hi.getLevel())) {
return 2;
}
return 1;
}
use of org.cache2k.core.HealthInfoElement in project cache2k by cache2k.
the class ManagerMXBeanImpl method constructHealthString.
static String constructHealthString(final List<HealthInfoElement> _sortedList) {
if (_sortedList.isEmpty()) {
return "ok";
}
boolean _comma = false;
StringBuilder sb = new StringBuilder();
for (HealthInfoElement hi : _sortedList) {
if (_comma) {
sb.append("; ");
}
sb.append(hi.getLevel()).append(": ").append("[").append(hi.getCache().getName() + "] ").append(hi.getMessage());
_comma = true;
}
return sb.toString();
}
use of org.cache2k.core.HealthInfoElement 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