我有以下代码:
actor {
loop {
react {
case SomeEvent =>
//I want to submit a piece of work to a queue and then send a response
//when that is finished. However, I don't want *this* actor to block
val params = "Some args"
val f: Future[Any] = myQueue.submitWork( params );
actor {
//await here
val response = f.get
publisher ! response
}
}
}
}
据我了解,外部参与者不会阻塞,f.get
因为这实际上是由一个单独的参与者(在SomeEvent
处理程序内部创建的参与者)执行的。
它是否正确?