Created
November 4, 2018 06:00
-
-
Save nanjingdaqi/8fd36599458811418e820d9621cf7816 to your computer and use it in GitHub Desktop.
double check singleton
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Sig { | |
private static volatile Sig sInstance; | |
private Sig() { | |
} | |
public static Sig getInstance() { | |
if (sInstance == null) { | |
synchronized(Sig.class) { | |
if (sInstance == null) { | |
sInstance = new Sig(); | |
} | |
} | |
} | |
return sInstance; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment