Fix available message test
Signed-off-by: Emmanuel Bigeon <emmanuel@bigeon.fr>
This commit is contained in:
parent
171f79518d
commit
0ab39b24f6
@ -177,7 +177,7 @@ public final class ReadingRunnable implements Runnable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void waitForDelivery(String message) throws InterruptedException {
|
public void waitForDelivery(final String message) throws InterruptedException {
|
||||||
Object mLock;
|
Object mLock;
|
||||||
synchronized (messageBlockerLock) {
|
synchronized (messageBlockerLock) {
|
||||||
if (!messageBlocker.containsKey(message)) {
|
if (!messageBlocker.containsKey(message)) {
|
||||||
@ -196,10 +196,11 @@ public final class ReadingRunnable implements Runnable {
|
|||||||
* @throws IOException if the pipe is closed */
|
* @throws IOException if the pipe is closed */
|
||||||
public boolean hasMessage() throws IOException {
|
public boolean hasMessage() throws IOException {
|
||||||
synchronized (lock) {
|
synchronized (lock) {
|
||||||
if (!running) {
|
final boolean empty = messages.isEmpty();
|
||||||
|
if (!running && empty) {
|
||||||
throw new IOException(CLOSED_PIPE);
|
throw new IOException(CLOSED_PIPE);
|
||||||
}
|
}
|
||||||
return !messages.isEmpty();
|
return !empty;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user