use of java8.util.concurrent.ForkJoinTask in project streamsupport by stefan-zobel.
the class CountedCompleterTest method testGetPool.
/**
* getPool of executing task returns its pool
*/
public void testGetPool() {
final ForkJoinPool mainPool = mainPool();
@SuppressWarnings("serial") ForkJoinTask<?> a = new CheckedRecursiveAction() {
protected void realCompute() {
assertSame(mainPool, getPool());
}
};
testInvokeOnPool(mainPool, a);
}
use of java8.util.concurrent.ForkJoinTask in project streamsupport by stefan-zobel.
the class ForkJoinTaskTest method testAbnormalInvokeAllCollection.
/**
* invokeAll(collection) throws exception if any task does
*/
public void testAbnormalInvokeAllCollection() {
@SuppressWarnings("serial") RecursiveAction a = new CheckedRecursiveAction() {
protected void realCompute() {
FailingAsyncFib f = new FailingAsyncFib(8);
AsyncFib g = new AsyncFib(9);
AsyncFib h = new AsyncFib(7);
ForkJoinTask<?>[] tasks = { f, g, h };
shuffle(tasks);
try {
invokeAll(Arrays.asList(tasks));
shouldThrow();
} catch (FJException success) {
checkCompletedAbnormally(f, success);
}
}
};
testInvokeOnPool(mainPool(), a);
}
Aggregations