AHeise commented on a change in pull request #13228:
URL: https://github.com/apache/flink/pull/13228#discussion_r476677925



##########
File path: 
flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/io/CheckpointedInputGate.java
##########
@@ -74,34 +106,34 @@ public CheckpointedInputGate(
        }
 
        @Override
-       public Optional<BufferOrEvent> pollNext() throws Exception {
-               while (true) {
-                       Optional<BufferOrEvent> next = inputGate.pollNext();
+       public Optional<BufferOrEvent> pollNext() throws IOException, 
InterruptedException {
+               Optional<BufferOrEvent> next = inputGate.pollNext();
 
-                       if (!next.isPresent()) {
-                               return handleEmptyBuffer();
-                       }
+               if (!next.isPresent()) {
+                       return handleEmptyBuffer();
+               }
 
-                       BufferOrEvent bufferOrEvent = next.get();
-                       
checkState(!barrierHandler.isBlocked(bufferOrEvent.getChannelInfo()));
+               BufferOrEvent bufferOrEvent = next.get();
+               
checkState(!barrierHandler.isBlocked(bufferOrEvent.getChannelInfo()));
 
-                       if (bufferOrEvent.isBuffer()) {
-                               return next;
-                       }
-                       else if (bufferOrEvent.getEvent().getClass() == 
CheckpointBarrier.class) {
-                               CheckpointBarrier checkpointBarrier = 
(CheckpointBarrier) bufferOrEvent.getEvent();
-                               
barrierHandler.processBarrier(checkpointBarrier, 
bufferOrEvent.getChannelInfo());
-                               return next;
-                       }
-                       else if (bufferOrEvent.getEvent().getClass() == 
CancelCheckpointMarker.class) {
-                               
barrierHandler.processCancellationBarrier((CancelCheckpointMarker) 
bufferOrEvent.getEvent());
-                       }
-                       else {
-                               if (bufferOrEvent.getEvent().getClass() == 
EndOfPartitionEvent.class) {
-                                       barrierHandler.processEndOfPartition();
-                               }
-                               return next;
-                       }
+               if (bufferOrEvent.isEvent()) {
+                       handleEvent(bufferOrEvent);
+               } else {
+                       barrierHandler.processBuffer(bufferOrEvent.getBuffer(), 
bufferOrEvent.getChannelInfo());

Review comment:
       Yes, it's used in the next commit to persist in-flight data (replaces 
`notifyBufferReceived`).




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


Reply via email to