Package org.rhq.enterprise.server.alert.engine

Examples of org.rhq.enterprise.server.alert.engine.AlertConditionCacheStats


        }
        return stats;
    }

    public AlertConditionCacheStats checkConditions(Availability... availabilities) {
        AlertConditionCacheStats stats = null;
        try {
            stats = globalCache.checkConditions(availabilities);
        } catch (Throwable t) {
            log.error("Error during checkConditions", t); // don't let any exceptions bubble up to the calling SLSB layer
        }
        if (stats == null) {
            stats = new AlertConditionCacheStats();
        }
        return stats;
    }
View Full Code Here


        }
        return stats;
    }

    public AlertConditionCacheStats checkConditions(AvailabilityDurationComposite... composites) {
        AlertConditionCacheStats stats = null;
        try {
            stats = globalCache.checkConditions(composites);
        } catch (Throwable t) {
            log.error("Error during checkConditions", t); // don't let any exceptions bubble up to the calling SLSB layer
        }
        if (stats == null) {
            stats = new AlertConditionCacheStats();
        }
        return stats;
    }
View Full Code Here

    /**
     * @return the number of conditions that re/loaded
     */
    private AlertConditionCacheStats loadCaches() {
        AlertConditionCacheStats stats = new AlertConditionCacheStats();

        try {
            log.debug("Loading Global Condition Cache...");

            Subject overlord = subjectManager.getOverlord();
View Full Code Here

                resourceConfigurationComposite.getResourceId(), cacheElement, alertConditionId, stats);
        }
    }

    public AlertConditionCacheStats checkConditions(OperationHistory operationHistory) {
        AlertConditionCacheStats stats = new AlertConditionCacheStats();
        try {
            if (operationHistory instanceof ResourceOperationHistory) {
                ResourceOperationHistory resourceOperationHistory = (ResourceOperationHistory) operationHistory;

                Resource resource = resourceOperationHistory.getResource();
                OperationDefinition operationDefinition = resourceOperationHistory.getOperationDefinition();
                OperationRequestStatus operationStatus = resourceOperationHistory.getStatus();

                List<ResourceOperationCacheElement> cacheElements = lookupResourceOperationHistoryCacheElements(
                    resource.getId(), operationDefinition.getId());

                processCacheElements(cacheElements, operationStatus, resourceOperationHistory.getModifiedTime(), stats);
            } else {
                if (log.isDebugEnabled())
                    log.debug(getClass().getSimpleName() + " does not support checking conditions against "
                        + operationHistory.getClass().getSimpleName() + " types");
            }

            AlertConditionCacheMonitor.getMBean().incrementOperationCacheElementMatches(stats.matched);
            AlertConditionCacheMonitor.getMBean().incrementOperationProcessingTime(stats.getAge());
            if (log.isDebugEnabled())
                log.debug("Check OperationHistory[size=1] - " + stats);
        } catch (Throwable t) {
            // don't let any exceptions bubble up to the calling SLSB layer
            log.error("Error during global cache processing: ", t);
View Full Code Here

        return stats;
    }

    public AlertConditionCacheStats checkConditions(ResourceConfigurationUpdate update) {
        if (update == null) {
            return new AlertConditionCacheStats();
        }

        AlertConditionCacheStats stats = new AlertConditionCacheStats();
        try {
            Resource resource = update.getResource();

            List<ResourceConfigurationCacheElement> cacheElements = lookupResourceConfigurationCacheElements(resource
                .getId());

            processCacheElements(cacheElements, update.getConfiguration(), update.getCreatedTime(), stats);

            AlertConditionCacheMonitor.getMBean().incrementResourceConfigurationCacheElementMatches(stats.matched);
            AlertConditionCacheMonitor.getMBean().incrementResourceConfigurationProcessingTime(stats.getAge());
            if (log.isDebugEnabled())
                log.debug("Check " + update + " - " + stats);
        } catch (Throwable t) {
            // don't let any exceptions bubble up to the calling SLSB layer
            log.error("Error during global cache processing: ", t);
View Full Code Here

        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);
View Full Code Here

    // 2) Second, after the duration period, check to see if the avail state is still the same.
    // Here we check for part 2, finish processing of the condition whose duration job finished and
    // determined the avail state to be satisfied.  Now hook into the alerting chassis...
    public AlertConditionCacheStats checkConditions(AvailabilityDurationComposite... composites) {
        if ((null == composites) || (composites.length == 0)) {
            return new AlertConditionCacheStats();
        }

        AlertConditionCacheStats stats = new AlertConditionCacheStats();
        try {
            for (AvailabilityDurationComposite composite : composites) {

                List<AvailabilityDurationCacheElement> cacheElements = lookupAvailabilityDurationCacheElements(composite
                    .getResourceId());

                // This method differs from the other <code>checkConditions<code> methods in that it is only
                // interested in a single condition for each composite, the one for which the duration job completed.
                if (!(null == cacheElements || cacheElements.isEmpty())) {
                    for (AvailabilityDurationCacheElement cacheElement : cacheElements) {
                        if (composite.getConditionId() == cacheElement.getAlertConditionTriggerId()) {
                            List<AvailabilityDurationCacheElement> cacheElementAsList = new ArrayList<AvailabilityDurationCacheElement>(
                                1);
                            cacheElementAsList.add(cacheElement);

                            processCacheElements(cacheElementAsList, composite.getAvailabilityType(),
                                System.currentTimeMillis(), stats);
                            break;
                        }
                    }
                }
            }

            AlertConditionCacheMonitor.getMBean().incrementAvailabilityDurationCacheElementMatches(stats.matched);
            AlertConditionCacheMonitor.getMBean().incrementAvailabilityDurationProcessingTime(stats.getAge());
            if (log.isDebugEnabled())
                log.debug("Check AvailabilityDuration[size=" + composites.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);
View Full Code Here

TOP

Related Classes of org.rhq.enterprise.server.alert.engine.AlertConditionCacheStats

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.