dev@glassfish.java.net

Re: Findbugs exception

From: Bobby Bissett <bbissett_at_gmail.com>
Date: Fri, 19 Apr 2013 08:33:56 -0400

On Fri, Apr 19, 2013 at 8:18 AM, John Wells <john.wells_at_oracle.com> wrote:

> So, it looks like, according to that article, that making controller
> volatile will fix this, right?
>
>
Yes, but now you're approaching just synchronizing all access in the first
place (and you'll set a bad example for the 2 JDK4 users out there, heh).
As the referenced blog mentions, there are better ways to handle this.
Other GF devs may have better suggestions, but the holder class idiom does
what you want without messing with the way threads are allowed to work.

http://tinyurl.com/cxr5esp (hopefully opens to the right page in Effective
Java in Google books)

Cheers,
Bobby