Is it safe to call a synchronized method from another synchronized method?
问题 If a synchronized method calls another synchronized method, is it thread safe? void synchronized method1() { method2() } void synchronized method2() { } 回答1: Yes, when you mark methods as synchronized , then you are really doing this: void method1() { synchronized (this) { method2() } } void method2() { synchronized (this) { } } When the thread call gets into method2 from method1, then it will ensure that it holds the lock to this , which it will already, and then it can pass through. When