Some Volatile Patterns

I've always regarded Java's volatile variables as voodoo variables. In fact, I've been scared off by very many articles telling you how terribly dangerous they are. In cases like these I tend to retreat to the safety of a few good patterns.

Except, I could never find any good patterns for using volatile. Luckily, Brian Goetz has just written an article solving this problem! Go check out Managing volatility.

The patterns are:

And hey, it's Brian Mr. Concurrency Goetz, so this stuff has to be good!

tag gen:Technorati Tags: Del.icio.us Tags:




This entry was posted in Java. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *