|
@@ -29,8 +29,10 @@ class WorkObject {
|
29
|
29
|
public synchronized void methodA() {
|
30
|
30
|
System.out.println("ThreadA의 methodA() 작업 실행");
|
31
|
31
|
notify(); //일시정지 상태에 있는 ThreadB를 실행대기 상태로 만듬.
|
|
32
|
+ System.out.println("ThreadA의 methodA() notify 이후");
|
32
|
33
|
try {
|
33
|
34
|
wait(); //ThreadA를 일시정지 상태로 만듬.
|
|
35
|
+ System.out.println("ThreadA의 methodA() wait 이후");
|
34
|
36
|
} catch (Exception e) {
|
35
|
37
|
}
|
36
|
38
|
}
|
|
@@ -38,8 +40,10 @@ class WorkObject {
|
38
|
40
|
public synchronized void methodB() {
|
39
|
41
|
System.out.println("ThreadB의 methodB() 작업 실행");
|
40
|
42
|
notify(); //일시정지 상태에 있는 ThreadA를 실행대기 상태로 만듬.
|
|
43
|
+ System.out.println("ThreadA의 methodB() notify 이후");
|
41
|
44
|
try {
|
42
|
45
|
wait(); //ThreadB를 일시정지 상태로 만듬.
|
|
46
|
+ System.out.println("ThreadA의 methodB() wait 이후");
|
43
|
47
|
} catch (Exception e) {
|
44
|
48
|
}
|
45
|
49
|
}
|