Merge with Peter's work (i.e. merging master into tame-globals)

This commit is contained in:
Roland 2011-10-13 14:17:07 +02:00
commit 44b94643e5
60 changed files with 2078 additions and 1700 deletions

View file

@ -8,10 +8,12 @@ import static akka.actor.Actors.poisonPill;
import static java.util.Arrays.asList;
import akka.actor.ActorRef;
import akka.actor.Actors;
import akka.actor.UntypedActor;
import akka.actor.UntypedActorFactory;
import akka.routing.RoutedProps;
import akka.routing.RouterType;
import akka.routing.LocalConnectionManager;
import akka.routing.Routing;
import akka.routing.Routing.Broadcast;
import scala.collection.JavaConversions;
@ -22,7 +24,7 @@ import java.util.concurrent.CountDownLatch;
import akka.AkkaApplication;
public class Pi {
private static final AkkaApplication app = new AkkaApplication();
public static void main(String[] args) throws Exception {
@ -112,7 +114,7 @@ public class Pi {
workers.add(worker);
}
router = app.routing().actorOf(RoutedProps.apply().withRoundRobinRouter().withConnections(workers), "pi");
router = app.createActor(new RoutedProps().withRoundRobinRouter().withLocalConnections(workers), "pi");
}
// message handler

View file

@ -61,7 +61,7 @@ object Pi extends App {
val workers = Vector.fill(nrOfWorkers)(app.createActor[Worker])
// wrap them with a load-balancing router
val router = app.routing.actorOf(RoutedProps().withRoundRobinRouter.withConnections(workers), "pi")
val router = app.createActor(RoutedProps().withRoundRobinRouter.withLocalConnections(workers), "pi")
// message handler
def receive = {

View file

@ -11,8 +11,10 @@ import static java.util.Arrays.asList;
import akka.AkkaApplication;
import akka.routing.RoutedProps;
import akka.routing.Routing;
import akka.routing.LocalConnectionManager;
import scala.Option;
import akka.actor.ActorRef;
import akka.actor.Actors;
import akka.actor.Channel;
import akka.actor.UntypedActor;
import akka.actor.UntypedActorFactory;
@ -24,7 +26,7 @@ import scala.collection.JavaConversions;
import java.util.LinkedList;
public class Pi {
private static final AkkaApplication app = new AkkaApplication();
public static void main(String[] args) throws Exception {
@ -105,7 +107,7 @@ public class Pi {
workers.add(worker);
}
router = app.routing().actorOf(RoutedProps.apply().withConnections(workers).withRoundRobinRouter(), "pi");
router = app.createActor(new RoutedProps().withRoundRobinRouter().withLocalConnections(workers), "pi");
}
@Override

View file

@ -9,7 +9,7 @@ import akka.event.EventHandler
import System.{ currentTimeMillis now }
import akka.routing.Routing.Broadcast
import akka.actor.{ Timeout, Channel, Actor, PoisonPill }
import akka.routing.{ RoutedProps, Routing }
import akka.routing._
import akka.AkkaApplication
object Pi extends App {
@ -56,7 +56,9 @@ object Pi extends App {
val workers = Vector.fill(nrOfWorkers)(app.createActor[Worker])
// wrap them with a load-balancing router
val router = app.routing.actorOf(RoutedProps().withConnections(workers).withRoundRobinRouter, "pi")
val router = app.createActor(RoutedProps(
routerFactory = () new RoundRobinRouter,
connectionManager = new LocalConnectionManager(workers)), "pi")
// phase 1, can accept a Calculate message
def scatter: Receive = {