Creating a ScheduledExectorService from a Scala ExecutionContext

Viewed 154

I'm trying to decouple an API from akka. I would like to take a scala ExecutionContext's thread pool and use that to create a java.util.concurrent.ScheduledExecutorService

Is this possible?

From what I can tell, ScheduledExecutorService can only create new threads and not leverage existing threads? Is that true?

What I really want to do is something like

val ec: ExecutionContext = scala.concurrent.ExecutionContext.global
val scheduler: ScheduledExecutorService = Executors.newScheduledThreadPool(ec)

However I can't seem to figure out how to do this?

0 Answers
Related