Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit e88e289

Browse files
Update JavaConcurrencyAdvancedCommonInterviewQuestions.md
单例模式实例修改,在单例方法上声明synchronized关键字是不必要的且会造成性能上的开销
1 parent 90f1744 commit e88e289

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

‎docs/java/Multithread/JavaConcurrencyAdvancedCommonInterviewQuestions.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public class Singleton {
7373
private Singleton() {
7474
}
7575

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

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /