Skip to content

Instantly share code, notes, and snippets.

@ShwetaChauhan18
Created September 4, 2018 10:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ShwetaChauhan18/327c05f2bd98aad5c15947a992ce1404 to your computer and use it in GitHub Desktop.
Save ShwetaChauhan18/327c05f2bd98aad5c15947a992ce1404 to your computer and use it in GitHub Desktop.
public static ThreadSafeSingleton getInstanceUsingDoubleLocking(){
if(mThreadSafeSingleton == null){
synchronized (ThreadSafeSingleton.class) {
if(mThreadSafeSingleton == null){
mThreadSafeSingleton = new ThreadSafeSingleton();
}
}
}
return mThreadSafeSingleton;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment