Exemple #1
0
 public static Map<String, Key> getKeyInstances(final EvaluationConstraint constraint) {
   return Maps.transformValues(
       Maps.filterValues(
           KEY_MAP,
           CollectionUtils.propertyContainsPredicate(
               constraint,
               Functions.compose(
                   PolicyKeyToEvaluationConstraints.INSTANCE, KeyClassToPolicyKey.INSTANCE))),
       KeyClassToKeyInstance.INSTANCE);
 }
 @Override
 public int registrationFailure(
     final AutoScalingGroupMetadata group, final Collection<String> instanceIds)
     throws AutoScalingMetadataException {
   final AutoScalingInstance example = exampleForGroup(group);
   final Map<String, Integer> failureCountMap = Maps.newHashMap();
   updateInstances(
       example,
       Predicates.alwaysTrue(),
       new Predicate<AutoScalingInstance>() {
         @Override
         public boolean apply(final AutoScalingInstance instance) {
           failureCountMap.put(instance.getInstanceId(), instance.incrementRegistrationAttempts());
           return true;
         }
       },
       instanceIds);
   return CollectionUtils.reduce(
       failureCountMap.values(), Integer.MAX_VALUE, CollectionUtils.min());
 }