Github user d2r commented on a diff in the pull request:

    https://github.com/apache/storm/pull/557#discussion_r30549645
  
    --- Diff: storm-core/src/jvm/backtype/storm/utils/TransferDrainer.java ---
    @@ -26,88 +26,47 @@
     
     public class TransferDrainer {
     
    -  private HashMap<String, ArrayList<ArrayList<TaskMessage>>> bundles = new 
HashMap();
    -  
    -  public void add(HashMap<String, ArrayList<TaskMessage>> 
workerTupleSetMap) {
    -    for (String key : workerTupleSetMap.keySet()) {
    -      
    -      ArrayList<ArrayList<TaskMessage>> bundle = bundles.get(key);
    -      if (null == bundle) {
    -        bundle = new ArrayList<ArrayList<TaskMessage>>();
    -        bundles.put(key, bundle);
    -      }
    -      
    -      ArrayList tupleSet = workerTupleSetMap.get(key);
    -      if (null != tupleSet && tupleSet.size() > 0) {
    -        bundle.add(tupleSet);
    -      }
    -    } 
    +  private ArrayList<TaskMessage> buffer = new ArrayList<TaskMessage>();
    +
    +  public void addAll(ArrayList<TaskMessage> tuples) {
    +    buffer.addAll(tuples);
    --- End diff --
    
    Yeah, I liked your suggestion of having the new buffer.  Before 
TransferDrainer was added, the buffer was just an ArrayList anyway.  I do not 
think it makes sense to have an ArrayList "inside" the TransferDrainer, because 
then we are implementing wrapper methods for `addAll` and `clear` that do not 
add value.


---
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.
---

Reply via email to