use of java8.util.concurrent.RecursiveAction 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.RecursiveAction 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.RecursiveAction 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);
}
use of java8.util.concurrent.RecursiveAction in project streamsupport by stefan-zobel.
the class ForkJoinTask8Test method testPollNextLocalTask.
/**
* pollNextLocalTask returns most recent unexecuted task without
* executing it
*/
public void testPollNextLocalTask() {
@SuppressWarnings("serial") RecursiveAction a = new CheckedRecursiveAction() {
protected void realCompute() {
AsyncFib g = new AsyncFib(9);
assertSame(g, g.fork());
AsyncFib f = new AsyncFib(8);
assertSame(f, f.fork());
assertSame(f, pollNextLocalTask());
helpQuiesce();
checkNotDone(f);
g.checkCompletedNormally();
}
};
testInvokeOnPool(singletonPool(), a);
}
use of java8.util.concurrent.RecursiveAction in project streamsupport by stefan-zobel.
the class ForkJoinTask8Test method testForkGet.
private void testForkGet(ForkJoinPool pool) {
@SuppressWarnings("serial") RecursiveAction a = new CheckedRecursiveAction() {
protected void realCompute() throws Exception {
AsyncFib f = new AsyncFib(8);
assertSame(f, f.fork());
assertNull(f.get());
f.checkCompletedNormally();
}
};
testInvokeOnPool(pool, a);
}
Aggregations