diff --git a/akka-remote/src/main/scala/akka/routing/RemoteRouterConfig.scala b/akka-remote/src/main/scala/akka/routing/RemoteRouterConfig.scala index 0584296238..73bf6948fe 100644 --- a/akka-remote/src/main/scala/akka/routing/RemoteRouterConfig.scala +++ b/akka-remote/src/main/scala/akka/routing/RemoteRouterConfig.scala @@ -6,7 +6,6 @@ package akka.routing import com.typesafe.config.ConfigFactory import akka.actor.ActorContext import akka.actor.ActorRef -import akka.actor.ActorSystemImpl import akka.actor.Deploy import akka.actor.InternalActorRef import akka.actor.Props @@ -18,6 +17,7 @@ import akka.actor.Address import scala.collection.JavaConverters._ import java.util.concurrent.atomic.AtomicInteger import java.lang.IllegalStateException +import akka.actor.ActorCell /** * [[akka.routing.RouterConfig]] implementation for remote deployment on defined @@ -72,12 +72,10 @@ class RemoteRouteeProvider(nodes: Iterable[Address], _context: ActorContext, _re format context.self.path.toString) case (n, Nil, ys) ⇒ - val impl = context.system.asInstanceOf[ActorSystemImpl] //TODO ticket #1559 IndexedSeq.empty[ActorRef] ++ (for (i ← 1 to nrOfInstances) yield { val name = "c" + childNameCounter.incrementAndGet val deploy = Deploy("", ConfigFactory.empty(), props.routerConfig, RemoteScope(nodeAddressIter.next)) - impl.provider.actorOf(impl, props, context.self.asInstanceOf[InternalActorRef], context.self.path / name, - systemService = false, Some(deploy), lookupDeploy = false, async = false) + context.asInstanceOf[ActorCell].attachChild(props.withDeploy(deploy), name, systemService = false) }) case (_, xs, _) ⇒ throw new ConfigurationException("Remote target.nodes can not be combined with routees for [%s]" diff --git a/akka-remote/src/test/scala/akka/remote/RemoteRouterSpec.scala b/akka-remote/src/test/scala/akka/remote/RemoteRouterSpec.scala index 1255489691..8d7effc5d9 100644 --- a/akka-remote/src/test/scala/akka/remote/RemoteRouterSpec.scala +++ b/akka-remote/src/test/scala/akka/remote/RemoteRouterSpec.scala @@ -67,10 +67,10 @@ akka.actor.deployment { nr-of-instances = 4 } }""").withFallback(system.settings.config) - val other = ActorSystem("remote-sys", conf) + val otherSystem = ActorSystem("remote-sys", conf) override def atTermination() { - other.shutdown() + otherSystem.shutdown() } "A Remote Router" must { @@ -199,6 +199,25 @@ akka.actor.deployment { system.stop(router) } + "set supplied supervisorStrategy" in { + val escalator = OneForOneStrategy() { + case e ⇒ + println("## " + e) + testActor ! e; SupervisorStrategy.Escalate + } + val router = system.actorOf(Props.empty.withRouter(new RemoteRouterConfig( + RoundRobinRouter(1, supervisorStrategy = escalator), + Seq(Address("akka", "remote-sys", "localhost", 12347)))), "blub3") + + router ! CurrentRoutees + EventFilter[ActorKilledException](occurrences = 1) intercept { + EventFilter[ActorKilledException](occurrences = 1).intercept { + expectMsgType[RouterRoutees].routees.head ! Kill + }(otherSystem) + } + expectMsgType[ActorKilledException] + } + } }