354 |
|
for (int i = 0; i < SIZE; ++i) { |
355 |
|
long t0 = System.nanoTime(); |
356 |
|
assertEquals(i, (int) q.poll(LONG_DELAY_MS, MILLISECONDS)); |
357 |
< |
assertTrue(millisElapsedSince(t0) < SHORT_DELAY_MS); |
357 |
> |
assertTrue(millisElapsedSince(t0) < SMALL_DELAY_MS); |
358 |
|
} |
359 |
+ |
long t0 = System.nanoTime(); |
360 |
|
aboutToWait.countDown(); |
361 |
|
try { |
362 |
|
q.poll(MEDIUM_DELAY_MS, MILLISECONDS); |
363 |
|
shouldThrow(); |
364 |
< |
} catch (InterruptedException success) {} |
364 |
> |
} catch (InterruptedException success) { |
365 |
> |
assertTrue(millisElapsedSince(t0) < MEDIUM_DELAY_MS); |
366 |
> |
} |
367 |
|
}}); |
368 |
|
|
369 |
|
aboutToWait.await(); |
385 |
|
for (int i = 0; i < SIZE; ++i) { |
386 |
|
long t0 = System.nanoTime(); |
387 |
|
assertEquals(i, (int) q.poll(LONG_DELAY_MS, MILLISECONDS)); |
388 |
< |
assertTrue(millisElapsedSince(t0) < SHORT_DELAY_MS); |
388 |
> |
assertTrue(millisElapsedSince(t0) < SMALL_DELAY_MS); |
389 |
|
} |
390 |
|
try { |
391 |
|
q.poll(MEDIUM_DELAY_MS, MILLISECONDS); |