File tree 2 files changed +4
-4
lines changed
src/main/java/com/iluwatar/twin
2 files changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -117,14 +117,14 @@ public class BallThread extends Thread {
117
117
118
118
public synchronized void resumeMe () {
119
119
isSuspended = false ;
120
- notify ();
120
+ notifyAll ();
121
121
LOGGER . info(" Resuming BallThread" );
122
122
}
123
123
124
124
public synchronized void stopMe () {
125
125
isRunning = false ;
126
126
isSuspended = false ;
127
- notify ();
127
+ notifyAll ();
128
128
}
129
129
}
130
130
```
Original file line number Diff line number Diff line change @@ -77,13 +77,13 @@ public synchronized void suspendMe() {
77
77
78
78
public synchronized void resumeMe () {
79
79
isSuspended = false ;
80
- notify (); // Wakes up the thread from waiting state.
80
+ notifyAll (); // Wakes up the thread from waiting state (prevents lost wake-ups) .
81
81
LOGGER .info ("Resuming BallThread" );
82
82
}
83
83
84
84
public synchronized void stopMe () {
85
85
isRunning = false ;
86
86
isSuspended = false ;
87
- notify (); // Makes sure the thread wakes up and exits (stops ).
87
+ notifyAll (); // Makes sure the thread wakes up and exits (prevents lost wake-ups ).
88
88
}
89
89
}
You can’t perform that action at this time.
0 commit comments