Skip to content

Commit

Permalink
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -159,7 +159,13 @@ public Object block() throws InterruptedException {
long now = System.currentTimeMillis();
long waited = now - start;
if (waited >= durationInMillis) {
return false;
// Try again to make sure we at least tried once
final Object result = queue.poll();
if (result == null) {
return false;
} else {
return result;
}
}

final Object result = queue.poll(durationInMillis, TimeUnit.MILLISECONDS);

0 comments on commit c9a1f69

Please sign in to comment.