RFR: 8280041: Retry loop issues in java.io.ClassCache [v3]

Peter Levart plevart at openjdk.java.net
Wed Jan 19 13:44:22 UTC 2022


On Wed, 19 Jan 2022 13:10:55 GMT, Peter Levart <plevart at 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


More information about the core-libs-dev mailing list