Last active
December 23, 2015 02:49
-
-
Save lzhoucs/df877c52f3800c8db1f8 to your computer and use it in GitHub Desktop.
A singleton pattern from Spring in Action 3rd
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
title file |
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 Stage { | |
private Stage() { | |
} | |
// Lazily loads instance | |
privatestaticclassStageSingletonHolder{ | |
staticStageinstance=newStage(); | |
} | |
public staticStagegetInstance(){ | |
returnStageSingletonHolder.instance; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment