zentol commented on a change in pull request #15049:
URL: https://github.com/apache/flink/pull/15049#discussion_r591478762



##########
File path: 
flink-runtime/src/main/java/org/apache/flink/runtime/util/BoundedFIFOQueue.java
##########
@@ -102,11 +102,12 @@ private BoundedFIFOQueue(int maxSize, Iterable<T> 
initialElements, int initialEl
      * @throws NullPointerException If {@code null} is passed as an element.
      */
     public void add(T element) {
-        elementCount++;
-        elements.add(Preconditions.checkNotNull(element));
+        if (elements.add(Preconditions.checkNotNull(element))) {

Review comment:
       we don't really need the condition. Even if we were to use some other 
data-structure in the future where the insertion might fail, based on the 
current semantics of elementCount it should be incremented in any case.




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