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_r287722898
 
 

 ##########
 File path: 
flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/io/BarrierBuffer.java
 ##########
 @@ -152,37 +155,37 @@ public BarrierBuffer(InputGate inputGate, BufferBlocker 
bufferBlocker, long maxB
                this.queuedBuffered = new ArrayDeque<BufferOrEventSequence>();
        }
 
+       @Override
+       public CompletableFuture<?> isAvailable() {
+               if (currentBuffered == null) {
+                       return inputGate.isAvailable();
+               }
+               return AVAILABLE;
+       }
+
        // 
------------------------------------------------------------------------
        //  Buffer and barrier handling
        // 
------------------------------------------------------------------------
 
        @Override
-       public BufferOrEvent getNextNonBlocked() throws Exception {
+       public Optional<BufferOrEvent> pollNext() throws Exception {
 
 Review comment:
   To make it really hard for a user to forget about checking for an empty 
result. Alternate/equivalent solution would be to mark it `@Nullable` and 
enable compile time errors about mishandling `null` (but that's almost 
impossible to do in our code base with so much legacy code).

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