We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b5302a1 commit 2ac2e62Copy full SHA for 2ac2e62
src/com/rabbitmq/utility/BlockingCell.java
@@ -76,11 +76,17 @@ public synchronized T get() throws InterruptedException {
76
* @throws InterruptedException if this thread is interrupted
77
*/
78
public synchronized T get(long timeout) throws InterruptedException, TimeoutException {
79
- if (timeout < 0 && timeout != INFINITY)
+ if (timeout == INFINITY) return get();
80
+
81
+ if (timeout < 0)
82
throw new AssertionError("Timeout cannot be less than zero");
83
84
if (!_filled && timeout != 0) {
- wait(timeout == INFINITY ? 0 : timeout);
85
+ long maxTime = System.currentTimeMillis() + timeout;
86
+ long now;
87
+ while ((now = System.currentTimeMillis()) < maxTime) {
88
+ wait(maxTime - now);
89
+ }
90
}
91
92
if (!_filled)
0 commit comments