private void refreshActualLRPs(List<DesiredLRPResponse> dlrps) { List<ActualLRPResponse> lrps = getReceptor().getActualLRPs(); Multimap<String, ActualLRPResponse> byProcessGuid = ArrayListMultimap.create(); for (ActualLRPResponse lrp : lrps) { byProcessGuid.put(lrp.getProcessGuid(), lrp); } for (DesiredLRPResponse dlrp : dlrps) { String processGuid = dlrp.getProcessGuid(); Collection<ActualLRPResponse> alrps = byProcessGuid.get(processGuid); LatticeBootDashElement el = getElementFor(processGuid); if (el != null) { el.setActualLrps(alrps); } } }
public List<DesiredLRPResponse> refreshDesiredLRPs() { List<DesiredLRPResponse> lrps = getReceptor().getDesiredLRPs(); Set<String> activeProcessGuids = new HashSet<String>(lrps.size()); for (DesiredLRPResponse dlrp : lrps) { activeProcessGuids.add(dlrp.getProcessGuid()); } ArrayList<BootDashElement> newElements = new ArrayList<BootDashElement>(); for (DesiredLRPResponse lrp : lrps) { String id = lrp.getProcessGuid(); LatticeBootDashElement el = ensureElement(id); newElements.add(el); el.setDesiredLrp(lrp); elementByProcessGuid.put(id, el); } elements.replaceAll(newElements); return lrps; }