How to create a scala.concurrent.ExecutionContext
If you want a fork-join pool:
ExecutionContext.fromExecutor(
new java.util.concurrent.ForkJoinPool(initialParallelism: Int)
)
If you want a fixed size thread pool:
ExecutionContext.fromExecutor(Executors.newFixedThreadPool(limit: Int))
I came across this recently and it's worth noting that:
type ForkJoinPool in package forkjoin is deprecated (since 2.12.0): use java.util.concurrent.ForkJoinPool directly, instead of this alias
The remedy for me was to replace the import of
import scala.concurrent.forkjoin.ForkJoinPool
with
import java.util.concurrent.ForkJoinPool
Everything then compiled as per the advice from VasyaNoviKov