This is nice in theory but has a number of drawbacks. First of all the common 
pool is not very easy to configure. It takes the available CPUs and if you run 
more than one VM you overcommit. Secondly different strategies to deal with 
longrunning or blocked jobs, with priority inheritance, with finegrained 
concurrency (you don't want to block all threads with some ill behaved tasks 
and therefore block all paralllel streams.

So it is a good idea to find a good shared default, but an API quite seldomly 
can isolate itself and the users about those aspects. So always allow to 
provide an alternate Executor. This also helps with thread naming, thread 
context, interceptors and error handlers.

Also, Once you have file or network or database jobs your task parallelity is 
not related with system CPUs anymore (and the runtimes become so unpredictable 
that it especially hurts parallelStream and and forkjoin users

Gruss
Bernd
-- 
http://bernd.eckenfels.net
>From Win 10 Mobile

Von: Christian Schulte

Reply via email to