Merge pull request #1290 from akka/wip-3077-deprecate-isTerminated-√
#3077 - Deprecating ActorRef.isTerminated
This commit is contained in:
commit
0d510ff031
12 changed files with 61 additions and 64 deletions
|
|
@ -115,10 +115,7 @@ class FaultHandlingDocSpec extends AkkaSpec with ImplicitSender {
|
|||
//#stop
|
||||
watch(child) // have testActor watch “child”
|
||||
child ! new IllegalArgumentException // break it
|
||||
expectMsgPF() {
|
||||
case t @ Terminated(`child`) if t.existenceConfirmed ⇒ ()
|
||||
}
|
||||
child.isTerminated must be(true)
|
||||
expectMsgPF() { case Terminated(`child`) ⇒ () }
|
||||
//#stop
|
||||
}
|
||||
EventFilter[Exception]("CRASH", occurrences = 2) intercept {
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ import akka.testkit.AkkaSpec
|
|||
import akka.event.Logging
|
||||
import akka.event.LoggingAdapter
|
||||
import scala.concurrent.duration._
|
||||
import akka.actor.{ Props, Actor, PoisonPill, ActorSystem }
|
||||
import akka.actor._
|
||||
|
||||
object DispatcherDocSpec {
|
||||
val config = """
|
||||
|
|
@ -227,7 +227,8 @@ class DispatcherDocSpec extends AkkaSpec(DispatcherDocSpec.config) {
|
|||
*/
|
||||
//#prio-dispatcher
|
||||
|
||||
awaitCond(a.isTerminated, 5 seconds)
|
||||
watch(a)
|
||||
expectMsgPF() { case Terminated(`a`) ⇒ () }
|
||||
}
|
||||
|
||||
"defining balancing dispatcher" in {
|
||||
|
|
|
|||
|
|
@ -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