...
Declaring variables as volatile
establishes a happens-before relationship such that a write to the volatile
variable is always seen by a subsequent read. Consequently, these operations appear to be sequentially consistent with respect to each other. Statements that occur before the write to the volatile
field also happen-before the read of the volatile
field.
...