use of java8.util.concurrent.RecursiveAction in project streamsupport by stefan-zobel.
the class ForkJoinPool8Test method testInForkJoinPool2.
/**
* inForkJoinPool of non-FJ task returns false
*/
public void testInForkJoinPool2() {
@SuppressWarnings("serial") RecursiveAction a = new CheckedRecursiveAction() {
protected void realCompute() {
assertFalse(inForkJoinPool());
}
};
assertNull(a.invoke());
}
use of java8.util.concurrent.RecursiveAction in project streamsupport by stefan-zobel.
the class ForkJoinPool8Test method testAbnormalQuietlyInvoke.
/**
* quietlyInvoke task returns when task completes abnormally
*/
public void testAbnormalQuietlyInvoke() {
@SuppressWarnings("serial") RecursiveAction a = new CheckedRecursiveAction() {
protected void realCompute() {
FailingFibAction f = new FailingFibAction(8);
f.quietlyInvoke();
assertTrue(f.getException() instanceof FJException);
checkCompletedAbnormally(f, f.getException());
}
};
checkInvoke(a);
}
use of java8.util.concurrent.RecursiveAction in project streamsupport by stefan-zobel.
the class ForkJoinPool8Test method testAbnormalForkQuietlyJoin.
/**
* quietlyJoin of a forked task returns when task completes abnormally
*/
public void testAbnormalForkQuietlyJoin() {
@SuppressWarnings("serial") RecursiveAction a = new CheckedRecursiveAction() {
protected void realCompute() {
FailingFibAction f = new FailingFibAction(8);
assertSame(f, f.fork());
f.quietlyJoin();
assertTrue(f.getException() instanceof FJException);
checkCompletedAbnormally(f, f.getException());
}
};
checkInvoke(a);
}
use of java8.util.concurrent.RecursiveAction in project streamsupport by stefan-zobel.
the class ForkJoinPool8Test method testCancelledForkGet.
/**
* get of a forked task throws exception when task cancelled
*/
public void testCancelledForkGet() {
@SuppressWarnings("serial") RecursiveAction a = new CheckedRecursiveAction() {
protected void realCompute() throws Exception {
FibAction f = new FibAction(8);
assertTrue(f.cancel(true));
assertSame(f, f.fork());
try {
f.get();
shouldThrow();
} catch (CancellationException success) {
checkCancelled(f);
}
}
};
checkInvoke(a);
}
use of java8.util.concurrent.RecursiveAction in project streamsupport by stefan-zobel.
the class ForkJoinPool8Test method testReinitializeAbnormal.
/**
* A reinitialized abnormally completed task may be re-invoked
*/
public void testReinitializeAbnormal() {
@SuppressWarnings("serial") RecursiveAction a = new CheckedRecursiveAction() {
protected void realCompute() {
FailingFibAction f = new FailingFibAction(8);
checkNotDone(f);
for (int i = 0; i < 3; i++) {
try {
f.invoke();
shouldThrow();
} catch (FJException success) {
checkCompletedAbnormally(f, success);
}
f.reinitialize();
checkNotDone(f);
}
}
};
checkInvoke(a);
}
Aggregations