Akka环境观察/ unwatch发生在之前的关系

oxb*_*kes 6 concurrency scala actor akka happens-before

我对两个actor, P C进行了以下顺序操作:

  1. PC(context watch c)
  2. P unwatches C(context unwatch c)
  3. P优雅地停止C(c ! PoisonPill)

我想知道的是; 我保证P 不会收到CTerminated活动吗?

这是一段代码示例

class HappensBefore extends App {
  class C extends Actor { def receive = {} } 
  class P extends Actor {
    val c = context actorOf Props[C]
    context watch c
    context unwatch c
    c ! PoisonPill
    def receive = { case Terminated(child) => println("Oh Noes!") }
  }
  ActorSystem("test") actorOf Props[P]
}
Run Code Online (Sandbox Code Playgroud)

Vik*_*ang 4

不,没有这样的保证。