Merge ClusterActoRef & RoutedActorRef: After merge with master

This commit is contained in:
Peter Veentjer 2011-08-29 09:22:14 +03:00
commit 56d4fc7d7c
14 changed files with 398 additions and 163 deletions

View file

@ -8,7 +8,7 @@ import akka.actor.{ Actor, PoisonPill }
import Actor._
import java.util.concurrent.CountDownLatch
import akka.routing.Routing.Broadcast
import akka.routing.Routing
import akka.routing.{ RoutedProps, Routing }
object Pi extends App {
@ -18,8 +18,11 @@ object Pi extends App {
// ===== Messages =====
// ====================
sealed trait PiMessage
case object Calculate extends PiMessage
case class Work(start: Int, nrOfElements: Int) extends PiMessage
case class Result(value: Double) extends PiMessage
// ==================
@ -55,7 +58,11 @@ object Pi extends App {
val workers = Vector.fill(nrOfWorkers)(actorOf[Worker].start())
// wrap them with a load-balancing router
val router = Routing.actorOfWithRoundRobin("pi", workers)
val router = Routing.actorOf(
RoutedProps.default
.withRoundRobinRouter()
.withConnections(workers)
.withDeployId("pi"))
// message handler
def receive = {