use of java8.util.concurrent.RecursiveAction in project streamsupport by stefan-zobel.
the class ForkJoinTaskTest method testAbnormalInvokeAll1.
/**
* invokeAll(tasks) with 1 argument throws exception if task does
*/
public void testAbnormalInvokeAll1() {
@SuppressWarnings("serial") RecursiveAction a = new CheckedRecursiveAction() {
protected void realCompute() {
FailingAsyncFib g = new FailingAsyncFib(9);
try {
invokeAll(g);
shouldThrow();
} catch (FJException success) {
checkCompletedAbnormally(g, success);
}
}
};
testInvokeOnPool(mainPool(), a);
}
use of java8.util.concurrent.RecursiveAction in project streamsupport by stefan-zobel.
the class ForkJoinPool8Test method testCancelledInvoke.
/**
* invoke task throws exception when task cancelled
*/
public void testCancelledInvoke() {
@SuppressWarnings("serial") RecursiveAction a = new CheckedRecursiveAction() {
protected void realCompute() {
FibAction f = new FibAction(8);
assertTrue(f.cancel(true));
try {
f.invoke();
shouldThrow();
} catch (CancellationException success) {
checkCancelled(f);
}
}
};
checkInvoke(a);
}
use of java8.util.concurrent.RecursiveAction in project streamsupport by stefan-zobel.
the class ForkJoinPool8Test method testInvokeAllNPE.
/**
* invokeAll(tasks) with any null task throws NPE
*/
public void testInvokeAllNPE() {
@SuppressWarnings("serial") RecursiveAction a = new CheckedRecursiveAction() {
protected void realCompute() {
FibAction f = new FibAction(8);
FibAction g = new FibAction(9);
FibAction h = null;
try {
invokeAll(f, g, h);
shouldThrow();
} catch (NullPointerException success) {
}
}
};
checkInvoke(a);
}
use of java8.util.concurrent.RecursiveAction in project streamsupport by stefan-zobel.
the class ForkJoinPool8Test method testForkQuietlyJoin.
/**
* quietlyJoin of a forked task returns when task completes
*/
public void testForkQuietlyJoin() {
@SuppressWarnings("serial") RecursiveAction a = new CheckedRecursiveAction() {
protected void realCompute() {
FibAction f = new FibAction(8);
assertSame(f, f.fork());
f.quietlyJoin();
assertEquals(21, f.result);
checkCompletedNormally(f);
}
};
checkInvoke(a);
}
use of java8.util.concurrent.RecursiveAction in project streamsupport by stefan-zobel.
the class ForkJoinPool8Test method testAbnormalInvoke.
/**
* invoke task throws exception when task completes abnormally
*/
public void testAbnormalInvoke() {
@SuppressWarnings("serial") RecursiveAction a = new CheckedRecursiveAction() {
protected void realCompute() {
FailingFibAction f = new FailingFibAction(8);
try {
f.invoke();
shouldThrow();
} catch (FJException success) {
checkCompletedAbnormally(f, success);
}
}
};
checkInvoke(a);
}
Aggregations