Re: JavaMemoryModel: String literals and String.intern()

From: Bill Pugh (
Date: Mon Apr 19 2004 - 13:08:21 EDT

This discussion has gotten a little off track. I think things here are
really pretty simple.

Interning the same String value twice is guaranteed to return the same
object only if the duration of references to those intern'd String
values overlap.

There is absolutely no desirable idiom that involves synchronizing
on String literals that could not be easily replaced by synchronizing
on some global constant.

So we don't need to worry about this in the memory model.


JavaMemoryModel mailing list -

This archive was generated by hypermail 2b29 : Thu Oct 13 2005 - 07:01:05 EDT