Source:
protected void processEvent(ClusterEvent event, ResourcesStateMap resourcesStateMap) throws Exception { _eventId = event.getEventId(); HelixManager manager = event.getAttribute(AttributeName.helixmanager.name()); BaseControllerDataProvider cache = event.getAttribute(AttributeName.ControllerDataProvider.name()); Map<String, Resource> resourceMap = event.getAttribute(AttributeName.RESOURCES_TO_REBALANCE.name()); CurrentStateOutput currentStateOutput = event.getAttribute(AttributeName.CURRENT_STATE.name()); Map<String, Map<String, Message>> pendingMessagesToCleanUp = new HashMap<>(); if (manager == null || cache == null || resourceMap == null || currentStateOutput == null || resourcesStateMap == null) { throw new StageException("Missing attributes in event:" + event + ". Requires HelixManager|DataCache|RESOURCES|CURRENT_STATE|INTERMEDIATE_STATE"); } Map<String, LiveInstance> liveInstances = cache.getLiveInstances(); Map<String, String> sessionIdMap = new HashMap<>(); for (LiveInstance liveInstance : liveInstances.values()) { sessionIdMap.put(liveInstance.getInstanceName(), liveInstance.getEphemeralOwner()); } MessageOutput output = new MessageOutput(); for (Resource resource : resourceMap.values()) { try { generateMessage(resource, cache, resourcesStateMap, currentStateOutput, manager, sessionIdMap, event.getEventType(), output, pendingMessagesToCleanUp); } catch (HelixException ex) { LogUtil.logError(logger, _eventId, "Failed to generate message for resource " + resource.getResourceName(), ex); } } if (!pendingMessagesToCleanUp.isEmpty()) { schedulePendingMessageCleanUp(pendingMessagesToCleanUp, cache.getAsyncTasksThreadPool(), manager.getHelixDataAccessor(), currentStateOutput.getStaleMessageMap()); } event.addAttribute(AttributeName.MESSAGES_ALL.name(), output); }

Target:
protected void processEvent(ClusterEvent event, ResourcesStateMap resourcesStateMap) throws Exception { _eventId = event.getEventId(); HelixManager manager = event.getAttribute(AttributeName.helixmanager.name()); BaseControllerDataProvider cache = event.getAttribute(AttributeName.ControllerDataProvider.name()); Map<String, Resource> resourceMap = event.getAttribute(AttributeName.RESOURCES_TO_REBALANCE.name()); CurrentStateOutput currentStateOutput = event.getAttribute(AttributeName.CURRENT_STATE.name()); Map<String, Map<String, Message>> messagesToCleanUp = new HashMap<>(); if (manager == null || cache == null || resourceMap == null || currentStateOutput == null || resourcesStateMap == null) { throw new StageException("Missing attributes in event:" + event + ". Requires HelixManager|DataCache|RESOURCES|CURRENT_STATE|INTERMEDIATE_STATE"); } Map<String, LiveInstance> liveInstances = cache.getLiveInstances(); Map<String, String> sessionIdMap = new HashMap<>(); for (LiveInstance liveInstance : liveInstances.values()) { sessionIdMap.put(liveInstance.getInstanceName(), liveInstance.getEphemeralOwner()); } MessageOutput output = new MessageOutput(); for (Resource resource : resourceMap.values()) { try { generateMessage(resource, cache, resourcesStateMap, currentStateOutput, manager, sessionIdMap, event.getEventType(), output, messagesToCleanUp); } catch (HelixException ex) { LogUtil.logError(logger, _eventId, "Failed to generate message for resource " + resource.getResourceName(), ex); } } if (!messagesToCleanUp.isEmpty()) { schedulePendingMessageCleanUp(messagesToCleanUp, cache.getAsyncTasksThreadPool(), manager.getHelixDataAccessor()); } event.addAttribute(AttributeName.MESSAGES_ALL.name(), output); }