Advanced Topics in Programming Languages: The Java Memory...
Why Stack Overflow recommends it
Stack Overflow users link it when answering questions about Java concurrency, instruction reordering, double-checked locking, final fields and lazy initialization, as a clear explanation of what the memory model actually guarantees.
Recommended by 6 people across 6 different months, 2008 to 2011.
What it is
A Google Tech Talk from the 'Advanced Topics in Programming Languages' series that explains the Java Memory Model as redefined in JDK 5. It covers the semantics of threads, synchronization, volatile variables and final fields, and how to write correct concurrent code, with Jeremy Manson presenting.
What people said
Strong rec Henrik Gustafsson · 2008-12 · Stack Overflow · on “Double checked locking Article”
See the Google Tech Talk on the Java Memory Model [this video] for a really nice introduction to the finer points of the JMM. Since it is missing here, I would also like to point out Jeremy Mansons blog 'Java Concurrency' [LINK] esp. the post on Double Checked locking [LINK] (anyone who is anything in the Java world seems to have an article on this :).
Strong rec Bou · 2009-03 · Stack Overflow · on “In what situations could an empty synchronized block achieve correct threading semantics?”
For an in depth look into Java's memory model, have a look at this video from Google's 'Advanced topics in programming languages' series: [this video] It gives a really nice overview of what the compiler can (often in theory, but sometimes in practice) do to your code. Essential stuff for any serious Java programmer!
Recommends andygavin · 2009-06 · Stack Overflow · on “JVM, Java, Multithreading, Object Creation”
Depending on where these assignments take place your program may be exhibiting statement reordering: the JVM may be instruction-reordering the assignment statements so they don't execute in the order you coded them. This is part of the Memory Model specification and could point to your program being under synchronized. See the JSR133 FAQ: [LINK] Or section 2 in: [LINK] An easier explanation begins at 10:40 in this video: [this video]
Recommends Roman · 2010-02 · Stack Overflow · on “Questions every good Java/Java EE Developer should be able to answer?”
I don't remember full answer, look this lection [this video] for good explaination. In nutshell: assume that method use volatile variable at some point. Then compiler doesn't optimize code of this method after that point.
Recommends Petro Semeniuk · 2011-01 · Stack Overflow · on “Too much nested class in my Swing class”
As Jochen mentioned you could use Eclipse Refactoring Tools. That won't solve design issues though. Generally: GUI knows about 14 classes and acts as big mediator... Is it possible to group logic into some higher level classes and have GUI use them? Your code mixes object construction with logic. Try to move those actions to different places Don't start a thread inside constructor! Revise usage of logical statements. Eg. : while(true){ ... if (pstop){ break; }} Is X10 3rd party class or your own? If it's yours try to remove global state(eg use single instance of X10 and instance variables for state change. Not static ones) The most important advise: Please try to write unit tests for this fu
Recommends maaartinus · 2011-08 · Stack Overflow · on “Is there an ImmutableBitSet in Java?”
I think, you're wrong. Watch this talk by Jeremy Manson [this video] at 46:10 to see what happens if you omit `final`.
Cites Rachel · 2011-09 · Stack Overflow · on “Threading : Lazy Initialization vs Static Lazy Initialization”
I am going through Java Memory Model video presentation and author is saying it is better to use Static Lazy Initialization compared to Lazy Initialization and I do not clear understand what he wants to say. I wanted to reach to community and would appreciate if someone can explain difference between Static Lazy Initialization and Lazy Initialization with simple java code example. Reference: Advanced Programming Topics - Java Memory Model [this video]