On Fri, 28 Feb 2025 18:59:52 GMT, Alexey Ivanov <[email protected]> wrote:

> *the unsynchronised access to the data structures doesn't gain anything*

The existing optimistic fast path can avoid the lock, with the assumption that 
garbage collection of the cache values are rare. It is fine. However these 
plain access do require that the cached values to be thread safe and support 
safe publication.

Given the huge complexity of this cache and confusions around it, I recommend 
checking out `jdk.internal.util.ReferencedKeyMap`, which is already exported to 
`java.desktop` module.

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

PR Comment: https://git.openjdk.org/jdk/pull/23845#issuecomment-2691383449

Reply via email to