use of java8.util.concurrent.ForkJoinPool in project streamsupport by stefan-zobel.
the class ForkJoinTask8Test method testInvokeAll2.
private void testInvokeAll2(ForkJoinPool pool) {
@SuppressWarnings("serial") RecursiveAction a = new CheckedRecursiveAction() {
protected void realCompute() {
AsyncFib[] tasks = { new AsyncFib(8), new AsyncFib(9) };
invokeAll(tasks[0], tasks[1]);
for (AsyncFib task : tasks) assertTrue(task.isDone());
for (AsyncFib task : tasks) task.checkCompletedNormally();
}
};
testInvokeOnPool(pool, a);
}
use of java8.util.concurrent.ForkJoinPool in project streamsupport by stefan-zobel.
the class ForkJoinTask8Test method testAbnormalInvokeAllCollection.
private void testAbnormalInvokeAllCollection(ForkJoinPool pool) {
@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(pool, a);
}
use of java8.util.concurrent.ForkJoinPool in project streamsupport by stefan-zobel.
the class ForkJoinTask8Test method testCompleteExceptionally.
private void testCompleteExceptionally(ForkJoinPool pool) {
@SuppressWarnings("serial") RecursiveAction a = new CheckedRecursiveAction() {
protected void realCompute() {
AsyncFib f = new AsyncFib(8);
f.completeExceptionally(new FJException());
try {
f.invoke();
shouldThrow();
} catch (FJException success) {
checkCompletedAbnormally(f, success);
}
}
};
testInvokeOnPool(pool, a);
}
use of java8.util.concurrent.ForkJoinPool in project streamsupport by stefan-zobel.
the class ForkJoinTask8Test method testInvoke.
private void testInvoke(ForkJoinPool pool) {
@SuppressWarnings("serial") RecursiveAction a = new CheckedRecursiveAction() {
protected void realCompute() {
AsyncFib f = new AsyncFib(8);
assertNull(f.invoke());
f.checkCompletedNormally();
}
};
testInvokeOnPool(pool, a);
}
use of java8.util.concurrent.ForkJoinPool in project streamsupport by stefan-zobel.
the class ForkJoinTask8Test method testGetPool.
private void testGetPool(ForkJoinPool pool) {
@SuppressWarnings("serial") RecursiveAction a = new CheckedRecursiveAction() {
protected void realCompute() {
assertSame(pool, getPool());
}
};
testInvokeOnPool(pool, a);
}
Aggregations