Source:
public void process(ClusterEvent event) throws Exception { _eventId = event.getEventId(); BaseControllerDataProvider cache = event.getAttribute(AttributeName.ControllerDataProvider.name()); final Map<String, Resource> resourceMap = event.getAttribute(AttributeName.RESOURCES.name()); final Map<String, Resource> resourceToRebalance = event.getAttribute(AttributeName.RESOURCES_TO_REBALANCE.name()); if (cache == null || resourceMap == null) { throw new StageException("Missing attributes in event:" + event + ". Requires DataCache|RESOURCE"); } Map<String, LiveInstance> liveInstances = cache.getLiveInstances(); final CurrentStateOutput currentStateOutput = new CurrentStateOutput(); for (LiveInstance instance : liveInstances.values()) { String instanceName = instance.getInstanceName(); String instanceSessionId = instance.getEphemeralOwner(); Map<String, Message> messages = cache.getMessages(instanceName); Map<String, Message> relayMessages = cache.getRelayMessages(instanceName); updatePendingMessages(instance, messages.values(), currentStateOutput, relayMessages.values(), resourceMap); Map<String, CurrentState> currentStateMap = cache.getCurrentState(instanceName, instanceSessionId); updateCurrentStates(instance, currentStateMap.values(), currentStateOutput, resourceMap); } event.addAttribute(AttributeName.CURRENT_STATE.name(), currentStateOutput); if (cache instanceof ResourceControllerDataProvider) { final ClusterStatusMonitor clusterStatusMonitor = event.getAttribute(AttributeName.clusterStatusMonitor.name()); reportInstanceCapacityMetrics(clusterStatusMonitor, (ResourceControllerDataProvider) cache, resourceToRebalance, currentStateOutput); } }

Target:
public void process(ClusterEvent event) throws Exception { _eventId = event.getEventId(); BaseControllerDataProvider cache = event.getAttribute(AttributeName.ControllerDataProvider.name()); final Map<String, Resource> resourceMap = event.getAttribute(AttributeName.RESOURCES.name()); final Map<String, Resource> resourceToRebalance = event.getAttribute(AttributeName.RESOURCES_TO_REBALANCE.name()); if (cache == null || resourceMap == null) { throw new StageException("Missing attributes in event:" + event + ". Requires DataCache|RESOURCE"); } Map<String, LiveInstance> liveInstances = cache.getLiveInstances(); final CurrentStateOutput currentStateOutput = new CurrentStateOutput(); for (LiveInstance instance : liveInstances.values()) { String instanceName = instance.getInstanceName(); String instanceSessionId = instance.getEphemeralOwner(); Map<String, Message> messages = cache.getMessages(instanceName); Map<String, Message> relayMessages = cache.getRelayMessages(instanceName); updatePendingMessages(instance, messages.values(), currentStateOutput, relayMessages.values(), resourceMap); Map<String, CurrentState> currentStateMap = cache.getCurrentState(instanceName, instanceSessionId); updateCurrentStates(instance, currentStateMap.values(), currentStateOutput, resourceMap); } event.addAttribute(AttributeName.CURRENT_STATE.name(), currentStateOutput); final ClusterStatusMonitor clusterStatusMonitor = event.getAttribute(AttributeName.clusterStatusMonitor.name()); if (clusterStatusMonitor != null && cache instanceof ResourceControllerDataProvider) { reportInstanceCapacityMetrics(clusterStatusMonitor, (ResourceControllerDataProvider) cache, resourceToRebalance, currentStateOutput); } }