Skip to content

Commit 658a113

Browse files
author
Simon MacMullen
committed
Clean up timeout logic.
1 parent f3b1776 commit 658a113

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

src/com/rabbitmq/utility/BlockingCell.java

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -80,15 +80,13 @@ public synchronized T get(long timeout) throws InterruptedException, TimeoutExce
8080

8181
if (timeout < 0)
8282
throw new AssertionError("Timeout cannot be less than zero");
83-
84-
if (!_filled && timeout != 0) {
85-
long maxTime = System.currentTimeMillis() + timeout;
86-
long now;
87-
while ((now = System.currentTimeMillis()) < maxTime) {
88-
wait(maxTime - now);
89-
}
83+
84+
long maxTime = System.currentTimeMillis() + timeout;
85+
long now;
86+
while (!_filled && (now = System.currentTimeMillis()) < maxTime) {
87+
wait(maxTime - now);
9088
}
91-
89+
9290
if (!_filled)
9391
throw new TimeoutException();
9492

0 commit comments

Comments
 (0)