[concurrency-interest] Pointless synchronized ?

Hanson Char hanson.char at gmail.com
Thu Apr 19 16:50:01 EDT 2007


I see code (in some pretty common opensource projects) like:

    private static ThreadLocal registry = new ThreadLocal() {
        protected synchronized Object initialValue() {
            // ...
        }
    };

It seems pointless to have the initialValue method synchronized, since
it's thread safe by nature.

Or am I missing something ?

Hanson Char


More information about the Concurrency-interest mailing list