[concurrency-interest] Thread Safety of java.lang.ClassValue

Zhong Yu zhong.j.yu at gmail.com
Fri Sep 16 18:31:04 EDT 2011

The impl of java.lang.ClassValue seems very wrong


The code calls get() on WeakHashMap without any memory fense, while
other threads could be updating the map concurrently. That cannot be
right!? Since this is in the java.lang pakcage, I have to assume first
that there's something I don't know. Could anyone double check the
source and see if it's correct?

Zhong Yu

More information about the Concurrency-interest mailing list