continue;
}
BigDecimal currentValue = value.get();
Alert lastAlert = alertsStore.getLastAlertForTargetOfCheck(target, check.getId());
AlertType lastState;
if (lastAlert == null) {
lastState = AlertType.OK;
} else {
lastState = lastAlert.getToType();
}
AlertType currentState = valueChecker.checkValue(currentValue, warn, error);
if (currentState.isWorseThan(worstState)) {
worstState = currentState;
}
if (isStillOk(lastState, currentState)) {
continue;
}
Alert alert = createAlert(target, currentValue, warn, error, lastState, currentState, now);
alertsStore.createAlert(check.getId(), alert);
// Only notify if the alert has changed state
if (stateIsTheSame(lastState, currentState)) {