forked from andyczy/czy-study-java-commons-utils
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSyncDubbo1.java
More file actions
43 lines (38 loc) · 755 Bytes
/
SyncDubbo1.java
File metadata and controls
43 lines (38 loc) · 755 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package thread.example01;
/**
* @auther 陈郑游
* @create 2017/4/3 0003
* @功能 synchronized的重入
* @问题
* @说明
* @URL地址
* @进度描述
*/
public class SyncDubbo1 {
public synchronized void method1(){
System.out.println("method1..");
method2();
}
public synchronized void method2(){
System.out.println("method2..");
method3();
method4();
}
public synchronized void method3(){
System.out.println("method3..");
}
public synchronized void method4(){
System.out.println("method4..");
}
//main
public static void main(String[] args) {
final SyncDubbo1 sd = new SyncDubbo1();
Thread t1 = new Thread(new Runnable() {
@Override
public void run() {
sd.method1();
}
});
t1.start();
}
}