fix two comments from Patrik

- map Iterable to Vector using breakOut instead of «Vector() ++ ...»
- give a name to the Pi sample actor system
This commit is contained in:
Roland 2011-12-13 11:20:36 +01:00
parent db7dd9450c
commit 4b2b41e725
3 changed files with 2 additions and 2 deletions

BIN
_mb/mailbox_user__b Normal file

Binary file not shown.

View file

@ -81,7 +81,7 @@ trait RouterConfig {
protected def createRoutees(props: Props, context: ActorContext, nrOfInstances: Int, targets: Iterable[String]): Vector[ActorRef] = (nrOfInstances, targets) match { protected def createRoutees(props: Props, context: ActorContext, nrOfInstances: Int, targets: Iterable[String]): Vector[ActorRef] = (nrOfInstances, targets) match {
case (0, Nil) throw new IllegalArgumentException("Insufficient information - missing configuration.") case (0, Nil) throw new IllegalArgumentException("Insufficient information - missing configuration.")
case (x, Nil) (1 to x).map(_ context.actorOf(props))(scala.collection.breakOut) case (x, Nil) (1 to x).map(_ context.actorOf(props))(scala.collection.breakOut)
case (_, xs) Vector.empty[ActorRef] ++ xs.map(context.actorFor(_)) case (_, xs) xs.map(context.actorFor(_))(scala.collection.breakOut)
} }
} }

View file

@ -87,7 +87,7 @@ object Pi extends App {
// ===== Run it ===== // ===== Run it =====
// ================== // ==================
def calculate(nrOfWorkers: Int, nrOfElements: Int, nrOfMessages: Int) { def calculate(nrOfWorkers: Int, nrOfElements: Int, nrOfMessages: Int) {
val system = ActorSystem() val system = ActorSystem("PiSystem")
// this latch is only plumbing to know when the calculation is completed // this latch is only plumbing to know when the calculation is completed
val latch = new CountDownLatch(1) val latch = new CountDownLatch(1)