File tree Expand file tree Collapse file tree 2 files changed +4
-4
lines changed
src/main/java/com/iluwatar/twin Expand file tree Collapse file tree 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 {
117117
118118 public synchronized void resumeMe () {
119119 isSuspended = false ;
120- notify ();
120+ notifyAll ();
121121 LOGGER . info(" Resuming BallThread" );
122122 }
123123
124124 public synchronized void stopMe () {
125125 isRunning = false ;
126126 isSuspended = false ;
127- notify ();
127+ notifyAll ();
128128 }
129129}
130130```
Original file line number Diff line number Diff line change @@ -77,13 +77,13 @@ public synchronized void suspendMe() {
7777
7878 public synchronized void resumeMe () {
7979 isSuspended = false ;
80- notify (); // Wakes up the thread from waiting state.
80+ notifyAll (); // Wakes up the thread from waiting state (prevents lost wake-ups) .
8181 LOGGER .info ("Resuming BallThread" );
8282 }
8383
8484 public synchronized void stopMe () {
8585 isRunning = false ;
8686 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 ).
8888 }
8989}
You can’t perform that action at this time.
0 commit comments