You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bookkeeper.apache.org by GitBox <gi...@apache.org> on 2022/12/17 08:23:09 UTC

[GitHub] [bookkeeper] Radiancebobo opened a new issue, #3705: [improvement] checkNotNull when use computeIfAbsent in ConcurrentLongHashMap and ConcurrentOpenHashMap

Radiancebobo opened a new issue, #3705:
URL: https://github.com/apache/bookkeeper/issues/3705

   # Motivation
   When use computeIfAbsent  in ConcurrentLongHashMap and ConcurrentOpenHashMap:
   ![image](https://user-images.githubusercontent.com/39521534/208232691-ca21ea1f-f4a3-4da5-8e7a-b081f8756791.png)
   There is a problem:
   1. According to the get algorithm, it is equivalent to not inserting the key-value pair(Key Not found), and it is meaningless for valueProvider.apply(key) to return null, but we have not prevented such things from happening
   2. When valueProvider.apply(key) returns null, unnecessary expansion will be performed at this time, and it cannot be recycled. It can only wait for reuse, which will cause leakage
   
   
   # Changes
   when value is null, should add checkNotNull  
   ![image](https://user-images.githubusercontent.com/39521534/208232186-1460c9e4-3f70-4b33-9a51-61b9704e08ba.png)
   


-- 
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: commits-unsubscribe@bookkeeper.apache.org.apache.org

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


[GitHub] [bookkeeper] Radiancebobo closed issue #3705: [improvement] Avoid leaks when use computeIfAbsent in ConcurrentLongHashMap and ConcurrentOpenHashMap

Posted by GitBox <gi...@apache.org>.
Radiancebobo closed issue #3705: [improvement] Avoid leaks  when use computeIfAbsent in ConcurrentLongHashMap and ConcurrentOpenHashMap
URL: https://github.com/apache/bookkeeper/issues/3705


-- 
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: commits-unsubscribe@bookkeeper.apache.org

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