Github user roshannaik commented on a diff in the pull request: https://github.com/apache/storm/pull/2241#discussion_r129945279 --- Diff: storm-client/src/jvm/org/apache/storm/utils/TransferDrainer.java --- @@ -21,101 +21,100 @@ import java.util.HashMap; import java.util.Iterator; import java.util.Map; +import java.util.Map.Entry; import org.apache.storm.generated.NodeInfo; import org.apache.storm.messaging.IConnection; import org.apache.storm.messaging.TaskMessage; -import com.google.common.collect.Maps; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class TransferDrainer { - private Map<Integer, ArrayList<ArrayList<TaskMessage>>> bundles = new HashMap(); + private Map<Integer, ArrayList<TaskMessage>> bundles = new HashMap(); + private static final Logger LOG = LoggerFactory.getLogger(TransferDrainer.class); - - public void add(HashMap<Integer, ArrayList<TaskMessage>> taskTupleSetMap) { - for (Map.Entry<Integer, ArrayList<TaskMessage>> entry : taskTupleSetMap.entrySet()) { - addListRefToMap(this.bundles, entry.getKey(), entry.getValue()); + + // Cache the msgs grouped by destination node + public void add(TaskMessage taskMsg) { + int destId = taskMsg.task(); + ArrayList<TaskMessage> msgs = bundles.get(destId); --- End diff -- thanks for that sweet tip! just to be sure, i would feel comfortable verifying with profiler first ... given this is in critical path.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---