tillrohrmann commented on a change in pull request #14897:
URL: https://github.com/apache/flink/pull/14897#discussion_r573715179



##########
File path: 
flink-runtime/src/main/java/org/apache/flink/runtime/util/ResourceCounter.java
##########
@@ -35,11 +37,12 @@
  * associated counts. The counts are always positive (> 0).
  */
 public final class ResourceCounter {

Review comment:
       The example with concurrency is that you don't have to lock accesses to 
an immutable object. If a component changes references to this object, then of 
course it needs to make sure that this happens under a lock if multiple threads 
can access it. But this is a concern of the component using the 
`ResourceCounter` and not the other way around.
   
   Your last idea is also what I had in mind with the immutable 
`ResourceCounter`. The `ResourceCounter` here would be what you called 
immutable `ResourceRequirement`. It just happens that the implementation of the 
`SlotPool` and `SlotManager` internally use the same class because it was 
easier and simpler to implement. It wouldn't speak anything against using a 
different representation which, for example, could be mutable and thus give us 
better performance. This is completely an implementation detail of the 
components returning a `ResourceCounter` in their API.




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


Reply via email to