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



##########
File path: 
flink-runtime/src/main/java/org/apache/flink/runtime/dispatcher/cleanup/DefaultResourceCleaner.java
##########
@@ -146,14 +146,15 @@ private Builder(
          */
         public Builder<T> withRegularCleanup(String label, T regularCleanup) {
             assertUniqueLabel(label);
-            this.regularCleanup.put(label, regularCleanup);
+            this.regularCleanup.add(new CleanupWithLabel<>(regularCleanup, 
label));
             return this;
         }
 
         private void assertUniqueLabel(String label) {
             Preconditions.checkArgument(
-                    !this.prioritizedCleanup.containsKey(label)
-                            && !this.regularCleanup.containsKey(label),
+                    Stream.concat(prioritizedCleanup.stream(), 
regularCleanup.stream())
+                            .map(CleanupWithLabel::getLabel)
+                            .noneMatch(label::equals),

Review comment:
       Why should they still be required to be unique?




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

To unsubscribe, e-mail: issues-unsubscr...@flink.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to