多线程5----重入锁1

1.

 1 public class SyncDubbo1 {
 2     public synchronized void method1(){
 3         System.out.println("method1...");
 4         method2();
 5     }
 6     public synchronized void method2(){
 7         System.out.println("method2...");
 8         method3();
 9     }
10     public synchronized void method3(){
11         System.out.println("method3...");
12     }
13     
14     public static void main(String[] args) {
15         final SyncDubbo1 syncDubbo1 = new SyncDubbo1();
16         Thread t1 = new Thread(new Runnable() {
17             @Override
18             public void run() {
19                 syncDubbo1.method1();
20             }
21         }, "t1");
22         
23         t1.start();
24     }
25   /*method1...
26     method2...
27     method3...*/
28 }
View Code
原文地址:https://www.cnblogs.com/bravolove/p/7944262.html