Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set java.util.concurrent.ForkJoinPool.common.parallelism java property?

Tags:

java

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 
like image 213
Stav Alfi Avatar asked Feb 27 '18 13:02

Stav Alfi


1 Answers

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.

like image 197
Can't Tell Avatar answered Sep 18 '22 12:09

Can't Tell