Assuming I have code as shown below:
Future<Object> executeBy(ExecutorService executor) {
return executor.submit(() -> {
throw new IllegalStateException();
});
}
no problem when using ForkJoinPool#commonPool, but when I use parallelism ForkJoinPool, it will double the value IllegalStateException. eg:
executeBy(new ForkJoinPool(1)).get();
Q1 : why does parallelism ForkJoinPooldouble the value Exceptionin Callable?
Q2 : How to avoid this strange behavior?
source
share