facebookarchive / stetho

Stetho is a debug bridge for Android applications, enabling the powerful Chrome Developer Tools and much more.

Home Page:http://facebook.github.io/stetho/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Double-Checked Locking

QiAnXinCodeSafe opened this issue · comments

https://github.com/facebook/stetho/blob/5cc93ec78908cdded19c5352a90635a33cf2fa7f/stetho/src/main/java/com/facebook/stetho/inspector/helper/IntegerFormatter.java#L19-L21

Double-Checked Locking is widely cited and used as an efficient method for implementing lazy initialization in a multithreaded environment.
Unfortunately, it will not work reliably in a platform independent way when implemented in Java, without additional synchronization.