oxb*_*kes 6 concurrency scala actor akka happens-before
我对两个actor,父 P和子 C进行了以下顺序操作:
context watch c
)context unwatch c
)c ! PoisonPill
)我想知道的是; 我保证P 不会收到C的Terminated
活动吗?
这是一段代码示例
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)