On the singleton 'getter', add 'synchronized' for thread safety
otherwise, findbugs will say something like "Incorrect lazy initialization of static field ..."
More explanation:
http://www.ibm.com/developerworks/java/library/j-dcl/index.html
http://en.wikipedia.org/wiki/Singleton_pattern
No comments:
Post a Comment