Seriously, that's how the Java memory manager has to treat that variable. It restricts how it may reorder operations that act upon it and enforces that whenever it is read or written, it must be done directly to memory instead of in a register.
From this article: "reads and writes of volatile fields would be made directly to main memory, instead of to registers or the local processor cache, and that actions on volatile variables on behalf of a thread are performed in the order that the thread requested."
Scanning Google presents a fewmoretechnicaldocuments on the subject. They are all about Java's memory model, of which the volatile keyword is a part. [ December 24, 2004: Message edited by: David Harkness ]
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad: