AHeise commented on a change in pull request #10029:  [FLINK-14553][runtime] 
Respect non-blocking output in StreamTask#processInput
URL: https://github.com/apache/flink/pull/10029#discussion_r341077614
 
 

 ##########
 File path: 
flink-runtime/src/main/java/org/apache/flink/runtime/io/AvailabilityProvider.java
 ##########
 @@ -29,10 +29,30 @@
 public interface AvailabilityProvider {
        /**
         * Constant that allows to avoid volatile checks {@link 
CompletableFuture#isDone()}. Check
-        * {@link #getAvailableFuture()} for more explanation.
+        * {@link #isAvailable()} and {@link #isVolatileAvailable()}for more 
explanation.
         */
        CompletableFuture<?> AVAILABLE = 
CompletableFuture.completedFuture(null);
 
+       /**
+        * Checks whether this instance is available via constant {@link 
#AVAILABLE} to avoid volatile access.
+        *
+        * @return true if this instance is available for further processing.
+        */
+       default boolean isAvailable() {
+               return getAvailableFuture() == AVAILABLE;
+       }
+
+       /**
+        * In order to avoid volatile access in {@link 
CompletableFuture#isDone()}, we check the condition
+        * of <code>future == AVAILABLE</code> firstly, so it would get 
performance benefits when hot looping.
+        *
+        * @return true if this instance is available for further processing.
+        */
+       default boolean isVolatileAvailable() {
 
 Review comment:
   `isVolatileAvailable` is quite technical / referring to implementation 
details, which may be fine in this case.
   
   I was thinking if we could rename the two methods on a more non-technical 
level:
   * `isAvailable` -> `isApproximatelyAvailable` (as this is not exact)
   * `isVolatileAvailable` -> `isAvailable` (this one is though and should be 
used if not for performance reason).

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