-
Enhancement
-
Resolution: Delivered
-
P4
-
None
-
19
-
generic
-
generic
A DESCRIPTION OF THE PROBLEM :
Currently, there’s multiple places in the JDK which reinvent the wheel to have a concurrent `WeakHashMap` by using `ConcurrentHashMap` with custom `WeakReference` subclasses for the keys, such as `java.lang.invoke.MethodType$ConcurrentWeakInternSet`.
I propose to add `ConcurrentWeakHashMap` that would implement the `java.util.concurrent.ConcurrentMap` interface but use `WeakReference`s for the keys.
Currently, there’s multiple places in the JDK which reinvent the wheel to have a concurrent `WeakHashMap` by using `ConcurrentHashMap` with custom `WeakReference` subclasses for the keys, such as `java.lang.invoke.MethodType$ConcurrentWeakInternSet`.
I propose to add `ConcurrentWeakHashMap` that would implement the `java.util.concurrent.ConcurrentMap` interface but use `WeakReference`s for the keys.