We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2c69c8b commit 5da9597Copy full SHA for 5da9597
pipeline/WaitNotifyPipeline.java
@@ -17,7 +17,7 @@ public WaitNotifyPipeline(int maxCapacity)
17
18
public synchronized Message receive() throws InterruptedException
19
{
20
- if (messageQueue.isEmpty())
+ while (messageQueue.isEmpty())
21
this.wait();
22
Message retVal = messageQueue.poll();
23
this.notify();
@@ -26,7 +26,7 @@ public synchronized Message receive() throws InterruptedException
26
27
public synchronized void send(Message message) throws InterruptedException
28
29
- if (messageQueue.size() == maxCapacity)
+ while (messageQueue.size() == maxCapacity)
30
31
messageQueue.add(message);
32
0 commit comments