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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to