Sei*_*ert 4 configuration dispatcher akka
我正在使用Akka 2.2-RC1,我无法让Akka从application.conf加载调度程序配置:
my-dispatcher {
type = PinnedDispatcher
executor = "thread-pool-executor"
}
akka.actor.deployment {
/test {
dispatcher = my-dispatcher
}
}
Run Code Online (Sandbox Code Playgroud)
从代码中实例化时
val test = system.actorOf(Props[Test], "test")
Run Code Online (Sandbox Code Playgroud)
按日志,它仍在使用akka.actor.default-dispatcher.
当我添加.withDispatcher("my-dispatcher")到道具时,所有都正常工作并被my-dispatcher使用.但我不喜欢加入.withDispatcher(...)我所有的演员......
有谁知道哪里可能有问题?我认为actor路径可能是错误的,但是apllication.conf路由配置正常工作(除了自定义routee调度程序之外).
经过一些测试后我发现这种效果是由于使用造成的RemoteActorRefProvider.一旦我禁用它并更改为默认值
akka.actor.provider = "akka.actor.LocalActorRefProvider"
Run Code Online (Sandbox Code Playgroud)
调度程序正在配置正确配置.
我想通过远程启用Akka在其他地方查找actor调度程序的配置,或者远程refs有不同的逻辑路径?
在你使用的相同版本的akka上,这对我来说很好.我的配置:
test{
my-dispatcher {
type = PinnedDispatcher
executor = "thread-pool-executor"
}
akka.actor.deployment {
/test-actor {
dispatcher = my-dispatcher
}
}
}
Run Code Online (Sandbox Code Playgroud)
我的代码:
object ActorTest{
def main(args: Array[String]) {
val conf = ConfigFactory.load()
val system = ActorSystem("test", conf.getConfig("test"))
val ref = system.actorOf(Props[TestActor], "test-actor")
}
}
class TestActor extends Actor{
def receive = {
case _ =>
}
}
Run Code Online (Sandbox Code Playgroud)
我使用了jconsole并显示固定调度程序列在"线程"选项卡下
| 归档时间: |
|
| 查看次数: |
4938 次 |
| 最近记录: |