From d6708184c6207425219cac6e1fa99fc0b241e586 Mon Sep 17 00:00:00 2001 From: Patrik Nordwall Date: Tue, 17 Jan 2012 14:48:46 +0100 Subject: [PATCH] Minor improvements based on feedback. See #1606 --- .../src/main/scala/akka/routing/Routing.scala | 14 +++++++++----- akka-docs/java/remoting.rst | 2 +- .../main/scala/akka/remote/RemoteDeployer.scala | 5 +---- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/akka-actor/src/main/scala/akka/routing/Routing.scala b/akka-actor/src/main/scala/akka/routing/Routing.scala index dc251145d7..7d711df200 100644 --- a/akka-actor/src/main/scala/akka/routing/Routing.scala +++ b/akka-actor/src/main/scala/akka/routing/Routing.scala @@ -175,11 +175,14 @@ class RouteeProvider(ref: RoutedActorRef, val context: ActorContext, val resizer context.self.asInstanceOf[RoutedActorRef].removeRoutees(routees) } - def createRoutees(props: Props, nrOfInstances: Int, routees: Iterable[String]): IndexedSeq[ActorRef] = (nrOfInstances, routees) match { - case (0, Nil) ⇒ throw new IllegalArgumentException("Insufficient information - missing configuration.") - case (x, Nil) ⇒ (1 to x).map(_ ⇒ context.actorOf(props))(scala.collection.breakOut) - case (_, xs) ⇒ xs.map(context.actorFor(_))(scala.collection.breakOut) - } + def createRoutees(props: Props, nrOfInstances: Int, routees: Iterable[String]): IndexedSeq[ActorRef] = + (nrOfInstances, routees) match { + case (x, Nil) if x <= 0 ⇒ + throw new IllegalArgumentException( + "Must specify nrOfInstances or routees for [%s]" format context.self.path.toString) + case (x, Nil) ⇒ (1 to x).map(_ ⇒ context.actorOf(props))(scala.collection.breakOut) + case (_, xs) ⇒ xs.map(context.actorFor(_))(scala.collection.breakOut) + } def createAndRegisterRoutees(props: Props, nrOfInstances: Int, routees: Iterable[String]): Unit = { if (resizer.isEmpty) { @@ -748,6 +751,7 @@ trait ScatterGatherFirstCompletedLike { this: RouterConfig ⇒ { case (sender, message) ⇒ + // FIXME avoid this cast val asker = routeeProvider.context.asInstanceOf[ActorCell].systemImpl.provider.ask(Timeout(within)).get asker.result.pipeTo(sender) message match { diff --git a/akka-docs/java/remoting.rst b/akka-docs/java/remoting.rst index 909315af46..05101497e1 100644 --- a/akka-docs/java/remoting.rst +++ b/akka-docs/java/remoting.rst @@ -69,7 +69,7 @@ The "app" in this case refers to the name of the ``ActorSystem``:: actor { deployment { /serviceA/retrieval { - remote = "akka://app@10.0.0.1:2552” + remote = "akka://app@10.0.0.1:2552" } } } diff --git a/akka-remote/src/main/scala/akka/remote/RemoteDeployer.scala b/akka-remote/src/main/scala/akka/remote/RemoteDeployer.scala index 120a2b87bb..de3e0825ff 100644 --- a/akka-remote/src/main/scala/akka/remote/RemoteDeployer.scala +++ b/akka-remote/src/main/scala/akka/remote/RemoteDeployer.scala @@ -23,10 +23,7 @@ class RemoteDeployer(_settings: ActorSystem.Settings) extends Deployer(_settings if (!str.isEmpty) throw new ConfigurationException("unparseable remote node name " + str) val nodes = deploy.config.getStringList("target.nodes").asScala if (nodes.isEmpty || deploy.routing == NoRouter) d - else { - val r = new RemoteRouterConfig(deploy.routing, nodes) - Some(deploy.copy(routing = r)) - } + else Some(deploy.copy(routing = new RemoteRouterConfig(deploy.routing, nodes))) } case None ⇒ None }