Re: [android-developers] Re: Android LifeCycle and Singleton Instances
Yep, you're correct.
However, if your 'getMySingleton()' method is called only occasionally (i.e. it is not part of some performance sensitive code-path), making it thread-safe like that is good enough. No need to squeeze out every optimization.
Using DCL or the 'on-demand' holder work all OK, but it just complicates things if they are not absolutely necessary. Less code an more readable. :-)
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home