How will the following java program run, in the ""happens-before" order example?
<p>Refer to the following program from the JLS.</p>

<p><img src="http://i.stack.imgur.com/kOvxj.gif" alt="http://java.sun.com/docs/books/jls/third_edition/html/memory7.gif"></p>

<p>the explanation of the program is at the end of this section: 
 <a href="http://java.sun.com/docs/books/jls/third_edition/html/memory.html#17.4.5" rel="nofollow">http://java.sun.com/docs/books/jls/third_edition/html/memory.html#17.4.5</a> </p>

<p>i can understand that r1 will be 1, but what is the value  of r2.  Does the write of x happens-before r2's read to x makes the r2=1? </p>

<p>since x is not synced, it could be in local memory and r2 can be 0??   I am not clear on this about the effect of happens-before order.   </p>
