You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by GitBox <gi...@apache.org> on 2023/01/10 12:19:47 UTC

[GitHub] [kafka] divijvaidya commented on pull request #13078: KAFKA-13999: Add ProducerCount metrics (KIP-847)

divijvaidya commented on PR #13078:
URL: https://github.com/apache/kafka/pull/13078#issuecomment-1377179705

   > Is there a reason we don't change the HashMap to a Concurrent*Map and just call `size()` on it? This way it becomes very clear that we expect some sort of a concurrent operation to happen on the map and we would like it to be ordered with respect to other operations and we do not have to rely on people knowing they need to interact with the `producers` map via additional functions?
   
   Using ConcurrentMaps would be ideal (we won't have to acquire a lock to perform read), but the `size()` operation of a concurrent map may produce stale data (case when it's being modified concurrently). The current approach guarantees that size is strongly consistent with the data stored in the map.


-- 
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: jira-unsubscribe@kafka.apache.org

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