754 |
|
final FutureTask task = new FutureTask(new NoOpCallable()); |
755 |
|
Thread t = newStartedThread(new CheckedRunnable() { |
756 |
|
public void realRun() throws Exception { |
757 |
+ |
long startTime = System.nanoTime(); |
758 |
+ |
|
759 |
|
Thread.currentThread().interrupt(); |
760 |
|
try { |
761 |
< |
task.get(2*LONG_DELAY_MS, MILLISECONDS); |
761 |
> |
task.get(randomTimeout(), randomTimeUnit()); |
762 |
|
shouldThrow(); |
763 |
|
} catch (InterruptedException success) {} |
764 |
|
assertFalse(Thread.interrupted()); |
765 |
|
|
766 |
|
pleaseInterrupt.countDown(); |
767 |
|
try { |
768 |
< |
task.get(2*LONG_DELAY_MS, MILLISECONDS); |
768 |
> |
task.get(LONG_DELAY_MS, MILLISECONDS); |
769 |
|
shouldThrow(); |
770 |
|
} catch (InterruptedException success) {} |
771 |
|
assertFalse(Thread.interrupted()); |
772 |
+ |
|
773 |
+ |
assertTrue(millisElapsedSince(startTime) < LONG_DELAY_MS); |
774 |
|
}}); |
775 |
|
|
776 |
|
await(pleaseInterrupt); |