416 |
|
int r = f.get(); |
417 |
|
assertTrue(r == 832040); |
418 |
|
} finally { |
419 |
< |
joinPool(p); |
419 |
> |
p.shutdownNow(); // don't wait out shutdown |
420 |
|
} |
421 |
|
} |
422 |
|
|
636 |
|
void realRun() throws Throwable { |
637 |
|
p.submit(new CheckedCallable<Object>() { |
638 |
|
public Object realCall() throws Throwable { |
639 |
< |
Thread.sleep(MEDIUM_DELAY_MS); |
639 |
> |
try { |
640 |
> |
Thread.sleep(MEDIUM_DELAY_MS); |
641 |
> |
} catch (InterruptedException ok) { |
642 |
> |
} |
643 |
|
return null; |
644 |
|
}}).get(); |
645 |
|
}}); |
647 |
|
t.start(); |
648 |
|
Thread.sleep(SHORT_DELAY_MS); |
649 |
|
t.interrupt(); |
650 |
+ |
t.join(); |
651 |
+ |
p.shutdownNow(); |
652 |
|
joinPool(p); |
653 |
|
} |
654 |
|
|
658 |
|
*/ |
659 |
|
public void testSubmitEE() throws Throwable { |
660 |
|
ForkJoinPool p = new ForkJoinPool(1); |
656 |
– |
|
661 |
|
try { |
662 |
< |
Callable c = new Callable() { |
663 |
< |
public Object call() { |
664 |
< |
int i = 5/0; |
665 |
< |
return Boolean.TRUE; |
666 |
< |
} |
663 |
< |
}; |
664 |
< |
|
665 |
< |
for (int i = 0; i < 5; i++) { |
666 |
< |
p.submit(c).get(); |
667 |
< |
} |
662 |
> |
p.submit(new Callable() { |
663 |
> |
public Object call() { |
664 |
> |
int i = 5/0; |
665 |
> |
return Boolean.TRUE; |
666 |
> |
}}).get(); |
667 |
|
shouldThrow(); |
668 |
|
} catch (ExecutionException success) { |
669 |
|
} |