InterviewSolution
| 1. |
How Can We Access The Thread Pool That Is Used By Parallel Stream Operations? |
|
Answer» The THREAD pool used for parallel STREAM operations can be accessed by ForkJoinPool.commonPool(). This WAY we can query its LEVEL of parallelism with commonPool.getParallelism(). The level cannot be changed at runtime but it can be configured by PROVIDING the following JVM parameter: -Djava.util.concurrent.ForkJoinPool.common.parallelism=5. The thread pool used for parallel stream operations can be accessed by ForkJoinPool.commonPool(). This way we can query its level of parallelism with commonPool.getParallelism(). The level cannot be changed at runtime but it can be configured by providing the following JVM parameter: -Djava.util.concurrent.ForkJoinPool.common.parallelism=5. |
|