Can we set java.util.concurrent.ForkJoinPool.common.parallelism java property?
System.out.println("getParallelism=" +ForkJoinPool.commonPool().getParallelism());
System.setProperty("java.util.concurrent.ForkJoinPool.common.parallelism","20");
Thread.sleep(1000);
System.out.println("getParallelism=" +ForkJoinPool.commonPool().getParallelism());
prints:
getParallelism=3
getParallelism=3
You have to set the parameter before the application starts. So passing a JVM parameter
-Djava.util.concurrent.ForkJoinPool.common.parallelism=20
at startup will change it to 20.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With