Skip to content

Commit 1e40b74

Browse files
committed
Update b-3Java多线程.md
1 parent e75ac3a commit 1e40b74

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

docs/b-3Java多线程.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ public class Singleton {
306306
private Singleton() {
307307
}
308308

309-
public static Singleton getUniqueInstance() {
309+
public synchronized static Singleton getUniqueInstance() {
310310
//先判断对象是否已经实例过,没有实例化过才进入加锁代码
311311
if (uniqueInstance == null) {
312312
//类对象加锁

0 commit comments

Comments
 (0)