170 |
|
try { |
171 |
|
new ForkJoinPool(-1); |
172 |
|
shouldThrow(); |
173 |
< |
} |
174 |
< |
catch (IllegalArgumentException success) {} |
173 |
> |
} catch (IllegalArgumentException success) {} |
174 |
|
} |
175 |
|
|
176 |
|
/** |
180 |
|
try { |
181 |
|
new ForkJoinPool(1, null); |
182 |
|
shouldThrow(); |
183 |
< |
} catch (NullPointerException success) { |
185 |
< |
} |
183 |
> |
} catch (NullPointerException success) {} |
184 |
|
} |
185 |
|
|
186 |
|
|
604 |
|
TrackedShortRunnable task = null; |
605 |
|
Future<?> future = e.submit(task); |
606 |
|
shouldThrow(); |
607 |
< |
} catch (NullPointerException success) { |
610 |
< |
} |
607 |
> |
} catch (NullPointerException success) {} |
608 |
|
} |
609 |
|
|
610 |
|
|
617 |
|
StringTask t = null; |
618 |
|
Future<String> future = e.submit(t); |
619 |
|
shouldThrow(); |
620 |
< |
} catch (NullPointerException success) { |
624 |
< |
} |
620 |
> |
} catch (NullPointerException success) {} |
621 |
|
} |
622 |
|
|
623 |
|
|
661 |
|
return Boolean.TRUE; |
662 |
|
}}).get(); |
663 |
|
shouldThrow(); |
664 |
< |
} catch (ExecutionException success) { |
665 |
< |
} |
664 |
> |
} catch (ExecutionException success) {} |
665 |
> |
|
666 |
|
joinPool(p); |
667 |
|
} |
668 |
|
|
695 |
|
} |
696 |
|
|
697 |
|
/** |
698 |
< |
* invokeAny(c) throws NullPointerException if c has null elements |
698 |
> |
* invokeAny(c) throws NullPointerException if c has a single null element |
699 |
|
*/ |
700 |
|
public void testInvokeAny3() throws Throwable { |
701 |
|
ExecutorService e = new ForkJoinPool(1); |
702 |
|
try { |
703 |
|
ArrayList<Callable<String>> l = new ArrayList<Callable<String>>(); |
708 |
– |
l.add(new StringTask()); |
704 |
|
l.add(null); |
705 |
|
e.invokeAny(l); |
706 |
|
shouldThrow(); |
711 |
|
} |
712 |
|
|
713 |
|
/** |
714 |
< |
* invokeAny(c) throws ExecutionException if no task in c completes |
714 |
> |
* invokeAny(c) throws NullPointerException if c has null elements |
715 |
|
*/ |
716 |
|
public void testInvokeAny4() throws Throwable { |
717 |
|
ExecutorService e = new ForkJoinPool(1); |
718 |
|
try { |
719 |
|
ArrayList<Callable<String>> l = new ArrayList<Callable<String>>(); |
720 |
+ |
l.add(new Callable<String>() { |
721 |
+ |
public String call() { |
722 |
+ |
// The delay gives the pool a chance to notice |
723 |
+ |
// the null element. |
724 |
+ |
sleepTillInterrupted(SMALL_DELAY_MS); |
725 |
+ |
return "foo"; |
726 |
+ |
}}); |
727 |
+ |
l.add(null); |
728 |
+ |
e.invokeAny(l); |
729 |
+ |
shouldThrow(); |
730 |
+ |
} catch (NullPointerException success) { |
731 |
+ |
} finally { |
732 |
+ |
joinPool(e); |
733 |
+ |
} |
734 |
+ |
} |
735 |
+ |
|
736 |
+ |
/** |
737 |
+ |
* invokeAny(c) throws ExecutionException if no task in c completes |
738 |
+ |
*/ |
739 |
+ |
public void testInvokeAny5() throws Throwable { |
740 |
+ |
ExecutorService e = new ForkJoinPool(1); |
741 |
+ |
try { |
742 |
+ |
ArrayList<Callable<String>> l = new ArrayList<Callable<String>>(); |
743 |
|
l.add(new NPETask()); |
744 |
|
e.invokeAny(l); |
745 |
|
shouldThrow(); |
752 |
|
/** |
753 |
|
* invokeAny(c) returns result of some task in c if at least one completes |
754 |
|
*/ |
755 |
< |
public void testInvokeAny5() throws Throwable { |
755 |
> |
public void testInvokeAny6() throws Throwable { |
756 |
|
ExecutorService e = new ForkJoinPool(1); |
757 |
|
try { |
758 |
|
ArrayList<Callable<String>> l = new ArrayList<Callable<String>>(); |