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

    https://github.com/apache/incubator-apex-core/pull/185#discussion_r48768935
  
    --- Diff: 
engine/src/main/java/com/datatorrent/stram/engine/GenericNode.java ---
    @@ -212,30 +225,60 @@ public final void run()
         long spinMillis = context.getValue(OperatorContext.SPIN_MILLIS);
         final boolean handleIdleTime = operator instanceof IdleTimeHandler;
         int totalQueues = inputs.size();
    +    int regularQueues = totalQueues;
    +    // regularQueues is the number of queues that are not connected to a 
DelayOperator
    +    for (String portName : inputs.keySet()) {
    +      if (isInputPortConnectedToDelayOperator(portName)) {
    +        regularQueues--;
    +      }
    +    }
     
    -    ArrayList<SweepableReservoir> activeQueues = new 
ArrayList<SweepableReservoir>();
    -    activeQueues.addAll(inputs.values());
    +    ArrayList<Map.Entry<String, SweepableReservoir>> activeQueues = new 
ArrayList<>();
    +    activeQueues.addAll(inputs.entrySet());
     
         int expectingBeginWindow = activeQueues.size();
         int receivedEndWindow = 0;
    +    long firstWindowId = -1;
     
         TupleTracker tracker;
         LinkedList<TupleTracker> resetTupleTracker = new 
LinkedList<TupleTracker>();
    -
         try {
           do {
    -        Iterator<SweepableReservoir> buffers = activeQueues.iterator();
    +        Iterator<Map.Entry<String, SweepableReservoir>> buffers = 
activeQueues.iterator();
       activequeue:
             while (buffers.hasNext()) {
    -          SweepableReservoir activePort = buffers.next();
    +          Map.Entry<String, SweepableReservoir> activePortEntry = 
buffers.next();
    +          SweepableReservoir activePort = activePortEntry.getValue();
               Tuple t = activePort.sweep();
    +          boolean needResetWindow = false;
               if (t != null) {
    +            boolean delay = (operator instanceof Operator.DelayOperator);
    +            long windowAhead = 0;
    +            if (delay) {
    +              windowAhead = 
WindowGenerator.getAheadWindowId(t.getWindowId(), firstWindowMillis, 
windowWidthMillis, 1);
    +              if (WindowGenerator.getBaseSecondsFromWindowId(windowAhead) 
> t.getBaseSeconds()) {
    --- End diff --
    
    Why is this `if` condition needed here? needResetWindow is only used in 
BEGIN_WINDOW tuple type (line 271). Have this `if` condition there itself


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to