The Javamex companion blog. This blog includes both technical articles relating to the programming information that you'll find on the Javamex site, plus information covering the IT industry more generally.
I believe that there is a small mistake with the double-checked locking example. Shouldn't the getInstance method not be synchronized on item (3) from the following page: http://www.javamex.com/tutorials/double_checked_locking_fixing.shtmlOtherwise the code loses the performance gains of using DCL plus it wouldn't need volatile at that point.Thanks for all the work on the site!
Thanks for spotting this. The whole point of item (3) is indeed that the getInstance() method itself no longer needs to be declared synchronized. The example has been duly corrected.
Post a Comment