return stats;
}
public AlertConditionCacheStats checkConditions(Availability... availabilities) {
if ((availabilities == null) || (availabilities.length == 0)) {
return new AlertConditionCacheStats();
}
AlertConditionCacheStats stats = new AlertConditionCacheStats();
try {
for (Availability availability : availabilities) {
Resource resource = availability.getResource();
AvailabilityType availabilityType = availability.getAvailabilityType();
List<AvailabilityCacheElement> cacheElements = lookupAvailabilityCacheElements(resource.getId());
processCacheElements(cacheElements, availabilityType, availability.getStartTime(), stats);
// Avail Duration conditions are evaluated in two parts:
// 1) First, an avail change that starts the clock ticking.
// 2) Second, after the duration period, check to see if the avail state is still the same.
// Here we check for part 1, see if we need to start duration processing for the avail change. If so,
// make sure we capture the avail start time, which is an agent time, not a server time, so we can
// correctly check for avail changes later (BZ 1099114).
List<AvailabilityDurationCacheElement> durationCacheElements = lookupAvailabilityDurationCacheElements(resource
.getId());
AvailabilityDurationCacheElement.checkCacheElements(durationCacheElements, resource, availability);
}
AlertConditionCacheMonitor.getMBean().incrementAvailabilityCacheElementMatches(stats.matched);
AlertConditionCacheMonitor.getMBean().incrementAvailabilityProcessingTime(stats.getAge());
if (log.isDebugEnabled())
log.debug("Check Availability[size=" + availabilities.length + "] - " + stats);
} catch (Throwable t) {
// don't let any exceptions bubble up to the calling SLSB layer
log.error("Error during global cache processing: ", t);