tillrohrmann commented on a change in pull request #11363: 
[FLINK-16440][runtime] Extend SlotManager metrics and status for dynamic slot 
allocation.
URL: https://github.com/apache/flink/pull/11363#discussion_r409673963
 
 

 ##########
 File path: 
flink-runtime/src/main/java/org/apache/flink/runtime/clusterframework/types/ResourceProfile.java
 ##########
 @@ -384,6 +384,31 @@ public ResourceProfile subtract(final ResourceProfile 
other) {
                );
        }
 
+       @Nonnull
+       public ResourceProfile multiply(final int multiplier) {
+               checkArgument(multiplier >= 0, "multiplier must be >= 0");
+               if (equals(ANY)) {
+                       return ANY;
+               }
+
+               if (this.equals(UNKNOWN)) {
+                       return UNKNOWN;
+               }
+
+               Map<String, Resource> resultExtendedResource = new 
HashMap<>(extendedResources.size());
+               extendedResources.forEach((String name, Resource resource) ->
+                       resultExtendedResource.put(name, 
resource.multiply(multiplier)));
 
 Review comment:
   I would use a foreach loop instead of `forEach`. Kiss, keep it simple, 
stupid.

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to