zhijiangW commented on a change in pull request #9478: [FLINK-13766][task] 
Refactor the implementation of StreamInputProcessor based on 
StreamTaskInput#emitNext
URL: https://github.com/apache/flink/pull/9478#discussion_r322529299
 
 

 ##########
 File path: 
flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/io/StreamTwoInputProcessor.java
 ##########
 @@ -171,30 +193,23 @@ public boolean processInput() throws Exception {
                }
                lastReadInputIndex = readingInputIndex;
 
-               StreamElement recordOrMark;
+               InputStatus status;
                if (readingInputIndex == 0) {
-                       recordOrMark = input1.pollNextNullable();
-                       if (recordOrMark != null) {
-                               processElement1(recordOrMark, 
input1.getLastChannel());
-                       }
-                       checkFinished(input1, lastReadInputIndex);
+                       status = input1.emitNext(output1);
                } else {
-                       recordOrMark = input2.pollNextNullable();
-                       if (recordOrMark != null) {
-                               processElement2(recordOrMark, 
input2.getLastChannel());
-                       }
-                       checkFinished(input2, lastReadInputIndex);
+                       status = input2.emitNext(output2);
                }
+               checkFinished(status, lastReadInputIndex);
 
-               if (recordOrMark == null) {
+               if (status != InputStatus.MORE_AVAILABLE) {
                        
inputSelectionHandler.setUnavailableInput(readingInputIndex);
                }
 
-               return recordOrMark != null;
+               return status == InputStatus.MORE_AVAILABLE;
        }
 
-       private void checkFinished(StreamTaskInput input, int inputIndex) 
throws Exception {
-               if (input.isFinished()) {
+       private void checkFinished(InputStatus status, int inputIndex) throws 
Exception {
+               if (status == InputStatus.END_OF_INPUT) {
 
 Review comment:
   Actually I did that in first version to rename the `checkFinished` as 
`checkStatus` which also covers the 
   ```
   if (status != InputStatus.MORE_AVAILABLE) {
        inputSelectionHandler.setUnavailableInput(readingInputIndex);
   }
   ```
   
   But in #9483 I integrated the above `if (status != 
InputStatus.MORE_AVAILABLE)` with other processes. So in this PR I kept the 
previous way to avoid repeated changes. :) 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to