Don't wait for queued messages if the timeout is negative. This requires a very close timing of when it thinks it should do another loop and when it actually does the loop. Fixes #14.
This commit is contained in:
parent
aa7b199bdb
commit
9c65662997
|
@ -105,10 +105,12 @@ public class User {
|
||||||
* @throws InterruptedException
|
* @throws InterruptedException
|
||||||
*/
|
*/
|
||||||
public void waitForNewMessageNotification(final long timeout) throws InterruptedException {
|
public void waitForNewMessageNotification(final long timeout) throws InterruptedException {
|
||||||
|
if (timeout > 0) {
|
||||||
synchronized (queuedMessageSynchronization) {
|
synchronized (queuedMessageSynchronization) {
|
||||||
queuedMessageSynchronization.wait(timeout);
|
queuedMessageSynchronization.wait(timeout);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method blocks if there are no messages to return, or perhaps if the queue is being
|
* This method blocks if there are no messages to return, or perhaps if the queue is being
|
||||||
|
|
Loading…
Reference in New Issue