1
votes

I am doing a disk intensive operation and I want to use my own thread-pool for it and not the default one.

I read the following link, and I am facing the exact same problem Akka :: dispatcher [%name%] not configured, using default-dispatcher

But my config file is slightly different, I have tried the suggestion but it not working. My application.conf in play has the following

 jpa-execution-context {
  thread-pool-executor {
    core-pool-size-factor = 10.0
    core-pool-size-max = 10
  }
}

And then in my test code I do the following, but I get an exception. Here is the test method

private def testContext():Future[Int]  = {
val system = ActorSystem.create()
val a = ActorSystem.create()
implicit val executionContext1 = system.dispatchers.lookup("jpa-execution-context")
Future{logger.error("inside my new thread pool wonderland");10}{executionContext1}

}

Here is the exception:

akka.ConfigurationException: Dispatcher [jpa-execution-context] not configured
1

1 Answers

2
votes

I think you forgot a few elements in your configuration:

jpa-execution-context {
  type = Dispatcher
  executor = "thread-pool-executor"
  thread-pool-executor {
    core-pool-size-factor = 10.0
    core-pool-size-max = 10
  }
}

Doc link: http://doc.akka.io/docs/akka/current/scala/dispatchers.html#types-of-dispatchers