list.parallelStream().forEach(element -> ...);
How can I limit the number of parallel threads nowadays?
There was a "hack" in the past to set a System property java.util.concurrent.ForkJoinPool.common.parallelism
. But that feels wrong, plus it does not work anymore.
Could you advise how to chunk the list into 4 divisions, and then only run those 4 devisions in parallel?