Skip to content

Commit e3598d6

Browse files
committed
add synchronized singleton
1 parent 9291065 commit e3598d6

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
public class SynchronizedSingleton
2+
{
3+
private static SynchronizedSingleton instance = null;
4+
5+
private SynchronizedSingleton()
6+
{
7+
}
8+
9+
synchronized static public SynchronizedSingleton getInstance()
10+
{
11+
if (instance == null)
12+
{
13+
instance = new SynchronizedSingleton();
14+
}
15+
return instance;
16+
}
17+
}

0 commit comments

Comments
 (0)