Added message notifications.

Signed-off-by: Emmanuel Bigeon <emmanuel@bigeon.fr>
This commit is contained in:
Emmanuel Bigeon 2018-11-26 10:40:40 -05:00
parent 4c1e28b04f
commit 9374c5a681

View File

@ -146,6 +146,7 @@ public final class ReadingRunnable implements Runnable {
public String getMessage() throws IOException {
synchronized (lock) {
if (!messages.isEmpty()) {
notifyMessage(messages.peek());
return messages.poll();
}
if (!running) {
@ -168,6 +169,7 @@ public final class ReadingRunnable implements Runnable {
public String getNextMessage(final long timeout) throws IOException {
synchronized (lock) {
if (!messages.isEmpty()) {
notifyMessage(messages.peek());
return messages.poll();
}
if (!running) {
@ -179,6 +181,7 @@ public final class ReadingRunnable implements Runnable {
if (messages.isEmpty()) {
return null;
}
notifyMessage(messages.peek());
return messages.poll();
}
}