RFR: JDK-8310913 Move ReferencedKeyMap to jdk.internal so it may be shared [v5]
Mandy Chung
mchung at openjdk.org
Thu Jul 6 20:02:04 UTC 2023
On Thu, 6 Jul 2023 19:59:11 GMT, Jim Laskey <jlaskey at 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:
>
> Add flag for reference queue type
src/java.base/share/classes/jdk/internal/util/ReferencedKeyMap.java line 107:
> 105: * be used, {@link WeakReference} otherwise.
> 106: * @param useNativeQueue true if uses NativeReferenceQueue
> 107: * otherwise use {@link ReferenceQueue}.
no such param for this constructor.
src/java.base/share/classes/jdk/internal/util/ReferencedKeyMap.java line 132:
> 130: */
> 131: public static <K, V> ReferencedKeyMap<K, V>
> 132: create(boolean isSoft, boolean useNativeQueue, Supplier<Map<ReferenceKey<K>, V>> supplier) {
I suggest to keep the previous `create(boolean isSoft, Supplier supplier)` factory method that defaults to non-native reference queue, which is commonly used. Only `MethodType` needs to use native reference queue.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/14684#discussion_r1254856896
PR Review Comment: https://git.openjdk.org/jdk/pull/14684#discussion_r1254860906
More information about the core-libs-dev
mailing list