Hi Valery,

On 11/05/2019 00:36, Valerie Peng wrote:
http://cr.openjdk.java.net/~valeriep/7107615/webrev.02/

Please let me know if you have more comments.

If I'm not mistaken, the only thing that references
the IdentityWrapper<Provider> is the key in the WeakHashMap.
Therefore, it is only weakly referenced and can be immediatly
garbage collected. I don't think this is what you want?

I believe what you are trying to achieve there is rather to use
a plain ConcurrentHashMap, and have IdentityWrapper extend
WeakReference<Provider> instead. You may need to store
the hashCode in IdentityWrapper so that it doesn't change
when the underlying Provider is garbage collected.

Then you can use a ReferenceQueue to purge the map regularly.

Hope this helps,

-- daniel

Reply via email to