720 |
|
/** |
721 |
|
* get is interruptible |
722 |
|
*/ |
723 |
< |
public void testGet_interruptible() { |
723 |
> |
public void testGet_Interruptible() { |
724 |
|
final CountDownLatch pleaseInterrupt = new CountDownLatch(1); |
725 |
|
final FutureTask task = new FutureTask(new NoOpCallable()); |
726 |
|
Thread t = newStartedThread(new CheckedRunnable() { |
749 |
|
/** |
750 |
|
* timed get is interruptible |
751 |
|
*/ |
752 |
< |
public void testTimedGet_interruptible() { |
752 |
> |
public void testTimedGet_Interruptible() { |
753 |
|
final CountDownLatch pleaseInterrupt = new CountDownLatch(1); |
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 |
– |
|
757 |
|
Thread.currentThread().interrupt(); |
758 |
|
try { |
759 |
|
task.get(randomTimeout(), randomTimeUnit()); |
763 |
|
|
764 |
|
pleaseInterrupt.countDown(); |
765 |
|
try { |
766 |
< |
task.get(LONG_DELAY_MS, MILLISECONDS); |
766 |
> |
task.get(LONGER_DELAY_MS, MILLISECONDS); |
767 |
|
shouldThrow(); |
768 |
|
} catch (InterruptedException success) {} |
769 |
|
assertFalse(Thread.interrupted()); |
772 |
– |
|
773 |
– |
assertTrue(millisElapsedSince(startTime) < LONG_DELAY_MS); |
770 |
|
}}); |
771 |
|
|
772 |
|
await(pleaseInterrupt); |
773 |
+ |
if (randomBoolean()) assertThreadBlocks(t, Thread.State.TIMED_WAITING); |
774 |
|
t.interrupt(); |
775 |
|
awaitTermination(t); |
776 |
|
checkNotDone(task); |