=doc #23421 move Kill docs around and fix snippet (#23429)

This commit is contained in:
Konrad `ktoso` Malawski 2017-09-27 15:32:01 +09:00 committed by GitHub
parent 6498cc234d
commit 40228e851d
3 changed files with 43 additions and 19 deletions

View file

@ -3,6 +3,7 @@
*/
package docs.actor
import akka.actor.Kill
import jdocs.actor.ImmutableMessage
import language.postfixOps
@ -586,15 +587,30 @@ class ActorDocSpec extends AkkaSpec("""
}
}
//#watch
val victim = system.actorOf(Props(classOf[WatchActor], this))
implicit val sender = testActor
//#kill
victim ! "kill"
expectMsg("finished")
//#kill
}
}
"using Kill" in {
val victim = system.actorOf(TestActors.echoActorProps)
implicit val sender = testActor
val context = this
//#kill
context.watch(victim) // watch the Actor to receive Terminated message once it dies
victim ! Kill
expectMsgPF(hint = "expecting victim to terminate") {
case Terminated(v) if v == victim => v // the Actor has indeed terminated
}
//#kill
}
"demonstrate ActorSelection" in {
val context = system
//#selection-local