Why does stream parallel() not use all available threads?
问题 I tried to run 100 Sleep tasks in parallel using Java8(1.8.0_172) stream.parallel() submitted inside a custom ForkJoinPool with 100+ threads available. Each task would sleep for 1s. I expected the whole work would finish after ~1s, given the 100 sleeps could be done in parallel. However I observe a runtime of 7s. @Test public void testParallelStream() throws Exception { final int REQUESTS = 100; ForkJoinPool forkJoinPool = null; try { // new ForkJoinPool(256): same results for all tried