#3077 - Deprecating ActorRef.isTerminated
This commit is contained in:
parent
718e2d115c
commit
7b263365aa
12 changed files with 61 additions and 64 deletions
|
|
@ -3,7 +3,7 @@
|
|||
*/
|
||||
package docs.routing
|
||||
|
||||
import akka.actor.{ Actor, ActorRef, ActorSystem, Props, ActorLogging }
|
||||
import akka.actor._
|
||||
import akka.routing.ConsistentHashingRouter.ConsistentHashable
|
||||
import akka.routing.FromConfig
|
||||
import akka.routing.RoundRobinRouter
|
||||
|
|
@ -37,8 +37,8 @@ class RouterViaProgramDocSpec extends AkkaSpec with ImplicitSender {
|
|||
val actor2 = system.actorOf(Props[ExampleActor1], "actor2")
|
||||
val actor3 = system.actorOf(Props[ExampleActor1], "actor3")
|
||||
val routees = Vector[String]("/user/actor1", "/user/actor2", "/user/actor3")
|
||||
val router = system.actorOf(Props().withRouter(
|
||||
RoundRobinRouter(routees = routees)))
|
||||
val router = system.actorOf(
|
||||
Props().withRouter(RoundRobinRouter(routees = routees)))
|
||||
//#programmaticRoutingRouteePaths
|
||||
1 to 6 foreach { i ⇒ router ! Message1(i) }
|
||||
val received = receiveN(6, 5.seconds.dilated)
|
||||
|
|
@ -59,45 +59,41 @@ class RouterViaProgramDocSpec extends AkkaSpec with ImplicitSender {
|
|||
}
|
||||
|
||||
"demonstrate PoisonPill" in {
|
||||
val router = system.actorOf(Props[Echo].withRouter(RoundRobinRouter(nrOfInstances = 5)))
|
||||
val router = watch(system.actorOf(Props[Echo].withRouter(RoundRobinRouter(nrOfInstances = 5))))
|
||||
//#poisonPill
|
||||
import akka.actor.PoisonPill
|
||||
router ! PoisonPill
|
||||
//#poisonPill
|
||||
expectNoMsg(1.seconds.dilated)
|
||||
router.isTerminated must be(true)
|
||||
expectMsgPF() { case Terminated(`router`) ⇒ () }
|
||||
}
|
||||
|
||||
"demonstrate broadcast of PoisonPill" in {
|
||||
val router = system.actorOf(Props[Echo].withRouter(RoundRobinRouter(nrOfInstances = 5)))
|
||||
val router = watch(system.actorOf(Props[Echo].withRouter(RoundRobinRouter(nrOfInstances = 5))))
|
||||
//#broadcastPoisonPill
|
||||
import akka.actor.PoisonPill
|
||||
import akka.routing.Broadcast
|
||||
router ! Broadcast(PoisonPill)
|
||||
//#broadcastPoisonPill
|
||||
expectNoMsg(1.seconds.dilated)
|
||||
router.isTerminated must be(true)
|
||||
expectMsgPF() { case Terminated(`router`) ⇒ () }
|
||||
}
|
||||
|
||||
"demonstrate Kill" in {
|
||||
val router = system.actorOf(Props[Echo].withRouter(RoundRobinRouter(nrOfInstances = 5)))
|
||||
val router = watch(system.actorOf(Props[Echo].withRouter(RoundRobinRouter(nrOfInstances = 5))))
|
||||
//#kill
|
||||
import akka.actor.Kill
|
||||
router ! Kill
|
||||
//#kill
|
||||
expectNoMsg(1.seconds.dilated)
|
||||
router.isTerminated must be(true)
|
||||
expectMsgPF() { case Terminated(`router`) ⇒ () }
|
||||
}
|
||||
|
||||
"demonstrate broadcast of Kill" in {
|
||||
val router = system.actorOf(Props[Echo].withRouter(RoundRobinRouter(nrOfInstances = 5)))
|
||||
val router = watch(system.actorOf(Props[Echo].withRouter(RoundRobinRouter(nrOfInstances = 5))))
|
||||
//#broadcastKill
|
||||
import akka.actor.Kill
|
||||
import akka.routing.Broadcast
|
||||
router ! Broadcast(Kill)
|
||||
//#broadcastKill
|
||||
expectNoMsg(1.seconds.dilated)
|
||||
router.isTerminated must be(true)
|
||||
expectMsgPF() { case Terminated(`router`) ⇒ () }
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue