Skip to content

Instantly share code, notes, and snippets.

@DavidTPate
Created February 17, 2014 01:39
Show Gist options
  • Save DavidTPate/9043249 to your computer and use it in GitHub Desktop.
Save DavidTPate/9043249 to your computer and use it in GitHub Desktop.
public class EagerStaticSingleton {
private static EagerStaticSingleton instance = null;
private EagerStaticSingleton() { }
static {
try {
instance = new EagerStaticSingleton();
} catch (Exception e) {
// Do something
}
}
public static EagerStaticSingleton getInstance() {
return instance;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment