File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed
CommonUtil/src/main/java/com/jingewenku/abrahamcaijin/commonutil Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change
1
+ package com .jingewenku .abrahamcaijin .commonutil ;
2
+
3
+ /**
4
+ * @Description:主要功能:Singleton helper class for lazily initialization
5
+ * @Prject: CommonUtilLibrary
6
+ * @Package: com.jingewenku.abrahamcaijin.commonutil
7
+ * @author: AbrahamCaiJin
8
+ * @date: 2017年05月24日 18:17
9
+ * @Copyright: 个人版权所有
10
+ * @Company:
11
+ * @version: 1.0.0
12
+ */
13
+
14
+ public abstract class SingletonUtils <T > {
15
+
16
+ private T instance ;
17
+
18
+ protected abstract T newInstance ();
19
+
20
+ public final T getInstance () {
21
+ if (instance == null ) {
22
+ synchronized (SingletonUtils .class ) {
23
+ if (instance == null ) {
24
+ instance = newInstance ();
25
+ }
26
+ }
27
+ }
28
+ return instance ;
29
+ }
30
+ }
You can’t perform that action at this time.
0 commit comments