2017-09-02 122 views
1

我正在执行磁盘密集型操作,我想使用自己的线程池而不是默认的线程池。Akka调度程序未在Play/Scala应用程序中配置异常

我阅读下面的链接,我面对完全一样的问题 Akka :: dispatcher [%name%] not configured, using default-dispatcher

但我的配置文件是稍有不同,我已经试过了建议,但它不能正常工作。 我在戏application.conf具有以下

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

然后在我的测试代码,我这样做,但我得到一个异常。下面是测试方法

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} 

}

这里是例外:

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

回答