Source:
public void syncAll(Collection<BaragonGroup> baragonGroups) { try { for (BaragonGroup baragonGroup : baragonGroups) { if (baragonGroup.getSources().isEmpty()) { LOG.debug("No traffic sources present for group {}", baragonGroup.getName()); } else { Collection<LoadBalancer> elbsForBaragonGroup = getLoadBalancersByBaragonGroup(baragonGroup); Collection<BaragonAgentMetadata> baragonAgents = getAgentsByBaragonGroup(baragonGroup); LOG.debug("Registering TargetGroup for baragon group {}", baragonGroup.getName()); Optional<TargetGroup> maybeTargetGroup = guaranteeTargetGroupFor(baragonGroup); if (maybeTargetGroup.isPresent()) { TargetGroup targetGroup = maybeTargetGroup.get(); LOG.debug("Registering new instances for group {}", baragonGroup.getName()); guaranteeRegistered(targetGroup, baragonAgents, elbsForBaragonGroup); if (configuration.isPresent() && configuration.get().isDeregisterEnabled()) { LOG.debug("De-registering old instances for group {}", baragonGroup.getName()); deregisterIfOld(baragonGroup, targetGroup, baragonAgents); } } LOG.debug("ELB sync complete for group {}", baragonGroup); } } } catch (AmazonClientException acexn) { LOG.error("Could not retrieve elb information due to ELB client error {}", acexn); exceptionNotifier.notify(acexn, ImmutableMap.of("groups", baragonGroups == null ? "" : baragonGroups.toString())); } catch (Exception exn) { LOG.error("Could not process ELB sync due to error {}", exn); exceptionNotifier.notify(exn, ImmutableMap.of("groups", baragonGroups == null ? "" : baragonGroups.toString())); } }

Target:
public void syncAll(Collection<BaragonGroup> baragonGroups) { Collection<LoadBalancer> allLoadBalancers = getAllLoadBalancers(baragonGroups); for (BaragonGroup baragonGroup : baragonGroups) { if (baragonGroup.getSources().isEmpty()) { LOG.debug("No traffic sources present for group {}", baragonGroup.getName()); } else { try { Collection<LoadBalancer> elbsForBaragonGroup = getLoadBalancersByBaragonGroup(allLoadBalancers, baragonGroup); Collection<BaragonAgentMetadata> baragonAgents = getAgentsByBaragonGroup(baragonGroup); LOG.debug("Looking for TargetGroup for baragon group {}", baragonGroup.getName()); Optional<TargetGroup> maybeTargetGroup = guaranteeTargetGroupFor(baragonGroup); if (maybeTargetGroup.isPresent()) { TargetGroup targetGroup = maybeTargetGroup.get(); Collection<TargetDescription> targets = targetsInTargetGroup(targetGroup); LOG.debug("Registering new instances for group {}", baragonGroup.getName()); guaranteeRegistered(targetGroup, targets, baragonAgents, elbsForBaragonGroup); if (configuration.isPresent() && configuration.get().isDeregisterEnabled()) { LOG.debug("De-registering old instances for group {}", baragonGroup.getName()); deregisterRemovableTargets(baragonGroup, targetGroup, baragonAgents, targets); } } else { LOG.debug("No TargetGroup for Baragon Group {}", baragonGroup); } LOG.debug("ELB sync complete for group {}", baragonGroup); } catch (AmazonClientException acexn) { LOG.error("Could not retrieve elb information due to ELB client error {}", acexn); exceptionNotifier.notify(acexn, ImmutableMap.of("baragonGroup", baragonGroup.toString())); } catch (Exception exn) { LOG.error("Could not process ELB sync due to error {}", exn); exceptionNotifier.notify(exn, ImmutableMap.of("groups", baragonGroup.toString())); } } } }