On Thu, 29 Jun 2023 18:24:33 GMT, Jim Laskey <jlas...@openjdk.org> wrote:
>> java.lang.runtime.ReferencedKeyMap was introduced to provide a concurrent >> caching scheme for Carrier objects. The technique used is generally useful >> for a variety of caching schemes and is being moved to be shared in other >> parts of the jdk. The MethodType interning case is one example. > > Jim Laskey has updated the pull request incrementally with one additional > commit since the last revision: > > Remove warning tied to String Templates MethodType's `ConcurrentWeakInternSet` uses `NativeReferenceQueue` which uses native monitors (that was added for virtual threads). This change uses the reference queue using j.u.c locks. Has you confirmed that this is not an issue? Or `ReferencedKeySet` can take a parameter to specify using the native reference queue? In `ReferencedKey::equals` method, can use `Reference::refersTo` instead of `Objects.equals`. src/java.base/share/classes/java/lang/invoke/MethodType.java line 899: > 897: return equals(mt); > 898: } > 899: if (x instanceof ConcurrentWeakInternSet.WeakEntry<?> e The comment above about `WeakEntry` should also be removed. ------------- PR Review: https://git.openjdk.org/jdk/pull/14684#pullrequestreview-1507601740 PR Review Comment: https://git.openjdk.org/jdk/pull/14684#discussion_r1248115440