I am using parallel collection to run some code in parallel. Here is the code
val threadIds = new ConcurrentSkipListSet[Long]()
val pool = new ForkJoinPool(250)
val forkJoinSupport = new ForkJoinTaskSupport(pool)
list.par.taskSupport = forkJoinSupport
list.par.map{ element =>
threadIds.add(Thread.currentThread().getId)
...
}
println(s"""No of actual threads in pool: ${threadIds.size()}: Threads = ${threadIds.asScala.mkString(",")}""")
The output from the println
statement always is 64
whereas the expected thread count is 250
No of actual threads in pool: 64: Threads = ...
Am I missing something here?
Note: The machine in which this application runs has 8 cores.