pnowojski commented on a change in pull request #8467: [FLINK-12535][network] 
Make CheckpointBarrierHandler non-blocking
URL: https://github.com/apache/flink/pull/8467#discussion_r285918092
 
 

 ##########
 File path: 
flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/io/StreamInputProcessor.java
 ##########
 @@ -206,27 +207,35 @@ public boolean processInput() throws Exception {
                                }
                        }
 
-                       final BufferOrEvent bufferOrEvent = 
barrierHandler.getNextNonBlocked();
-                       if (bufferOrEvent != null) {
-                               if (bufferOrEvent.isBuffer()) {
-                                       currentChannel = 
bufferOrEvent.getChannelIndex();
-                                       currentRecordDeserializer = 
recordDeserializers[currentChannel];
-                                       
currentRecordDeserializer.setNextBuffer(bufferOrEvent.getBuffer());
-                               }
-                               else {
-                                       // Event received
-                                       final AbstractEvent event = 
bufferOrEvent.getEvent();
-                                       if (event.getClass() != 
EndOfPartitionEvent.class) {
-                                               throw new 
IOException("Unexpected event: " + event);
+                       final Optional<BufferOrEvent> bufferOrEvent = 
barrierHandler.pollNext();
+                       if (bufferOrEvent.isPresent()) {
+                               processBufferOrEvent(bufferOrEvent.get());
+                       } else {
+                               if (!barrierHandler.isFinished()) {
+                                       barrierHandler.isAvailable().get();
 
 Review comment:
   I don't like it much either, but the same comment about more refactoring 
applies here. In an essence, introduction of `NetworkInput` is already a 
refactor/clean up/extracting part of the logic.

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