On Wed, 19 Jan 2022 13:10:55 GMT, Peter Levart <plev...@openjdk.org> wrote:

> Note this matches other places we do the weak-reference loops, for example in 
> `MethodType`: 
> https://github.com/openjdk/jdk/blob/master/src/java.base/share/classes/java/lang/invoke/MethodType.java#L1390-L1401

This one does not have the same problem. It does guarantee progress. But it has 
another problem. This variant busy-loops while waiting for cleared 
WeakRefefence to be eventually enqueued by GC / Reference enqueue-ing thread. 
It could, in addition, pro-actively remove the entry from the map as soon as it 
finds the WeakReference cleared (with Map.remove(key, value)).

-------------

PR: https://git.openjdk.java.net/jdk/pull/7092

Reply via email to