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:
Andy Janata 2012-11-09 19:55:15 -08:00
parent aa7b199bdb
commit 9c65662997
1 changed files with 4 additions and 2 deletions

View File

@ -105,8 +105,10 @@ public class User {
* @throws InterruptedException
*/
public void waitForNewMessageNotification(final long timeout) throws InterruptedException {
synchronized (queuedMessageSynchronization) {
queuedMessageSynchronization.wait(timeout);
if (timeout > 0) {
synchronized (queuedMessageSynchronization) {
queuedMessageSynchronization.wait(timeout);
}
}
}