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_r318363758
 
 

 ##########
 File path: 
flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/io/StreamTwoInputSelectableProcessor.java
 ##########
 @@ -381,12 +333,28 @@ private ForwardingValveOutputHandler(
                        this.streamStatusMaintainer = 
checkNotNull(streamStatusMaintainer);
 
                        this.inputWatermarkGauge = inputWatermarkGauge;
+                       this.numRecordsIn = checkNotNull(numRecordsIn);
 
                        this.inputIndex = inputIndex;
                }
 
                @Override
-               public void handleWatermark(Watermark watermark) throws 
Exception {
+               @SuppressWarnings("unchecked")
+               public void emitRecord(StreamRecord record) throws Exception {
+                       synchronized (lock) {
+                               numRecordsIn.inc();
+                               if (inputIndex == 0) {
 
 Review comment:
   Yes, I think you might be right for this performance concern. If we have two 
separate subclasses to implement abstract `emitRecords`, it could work.
   Another possible option is to use the consumer function in my first version, 
then we could implement this function in `StreamTwoInputSelectableProcessor` 
and pass it into output constructor. This way seems a bit simple because it 
only relies on one class `StreamTaskNetworkOutput`, otherwise we need three 
classes (one abstract class and two subclasses). WDYT?

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