Package com.netflix.simianarmy.janitor

Examples of com.netflix.simianarmy.janitor.Rule


        LOGGER.debug(String.format("Checking if resource %s of type %s is a cleanup candidate against %d rules.",
                resource.getId(), resource.getResourceType(), rules.size()));
        // We create a clone of the resource each time when we try the rule. In the first iteration of the rules
        // we identify the rule with the nearest termination date if there is any rule considers the resource
        // as a cleanup candidate. Then the rule is applied to the original resource.
        Rule nearestRule = null;
        if (rules.size() == 1) {
            nearestRule = rules.get(0);
        } else {
            Date nearestTerminationTime = null;
            for (Rule rule : rules) {
                Resource clone = resource.cloneResource();
                if (!rule.isValid(clone) && (nearestTerminationTime == null
                        || nearestTerminationTime.after(clone.getExpectedTerminationTime()))) {
                    nearestRule = rule;
                    nearestTerminationTime = clone.getExpectedTerminationTime();
                }
            }
        }
        if (nearestRule != null && !nearestRule.isValid(resource)) {
            LOGGER.info(String.format("Resource %s is marked as a cleanup candidate.", resource.getId()));
            return false;
        } else {
            LOGGER.info(String.format("Resource %s is not marked as a cleanup candidate.", resource.getId()));
            return true;
View Full Code Here

TOP

Related Classes of com.netflix.simianarmy.janitor.Rule

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.