Wednesday, October 29, 2008

Josh Bloch interview

Nice interview. Something of note:
If you need high-performance lazy initializing of an instance field, use the double-check idiom with a volatile field. This idiom wasn't guaranteed to work until release 5.0, when the platform got a new memory model. The idiom is very fast but also complicated and delicate, so don't be tempted to modify it in any way. Just copy and paste -- normally not a good idea, but appropriate here...

http://java.sun.com/developer/technicalArticles/Interviews/bloch_effective_08_qa.html

No comments: