make everything except tutorial-second compile

someone should look at remoting vs. timeout (i.e. which is sent around),
because I removed that in some places. It might simply be irrelevant
once we remove the Future special-casing.
This commit is contained in:
Roland 2011-10-12 09:10:05 +02:00
parent 93b1ef3703
commit 14751f7d29
22 changed files with 300 additions and 254 deletions

View file

@ -4,7 +4,6 @@
package akka.tutorial.first.java;
import static akka.actor.Actors.actorOf;
import static akka.actor.Actors.poisonPill;
import static java.util.Arrays.asList;
@ -20,7 +19,11 @@ import scala.collection.JavaConversions;
import java.util.LinkedList;
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 {
Pi pi = new Pi();
@ -105,11 +108,11 @@ public class Pi {
LinkedList<ActorRef> workers = new LinkedList<ActorRef>();
for (int i = 0; i < nrOfWorkers; i++) {
ActorRef worker = actorOf(Worker.class, "worker");
ActorRef worker = app.createActor(Worker.class);
workers.add(worker);
}
router = Routing.actorOf(RoutedProps.apply().withRoundRobinRouter().withConnections(workers), "pi");
router = app.routing().actorOf(RoutedProps.apply().withRoundRobinRouter().withConnections(workers), "pi");
}
// message handler
@ -163,11 +166,11 @@ public class Pi {
final CountDownLatch latch = new CountDownLatch(1);
// create the master
ActorRef master = actorOf(new UntypedActorFactory() {
ActorRef master = app.createActor(new UntypedActorFactory() {
public UntypedActor create() {
return new Master(nrOfWorkers, nrOfMessages, nrOfElements, latch);
}
}, "master");
});
// start the calculation
master.tell(new Calculate());

View file

@ -9,8 +9,11 @@ import Actor._
import java.util.concurrent.CountDownLatch
import akka.routing.Routing.Broadcast
import akka.routing.{ RoutedProps, Routing }
import akka.AkkaApplication
object Pi extends App {
val app = AkkaApplication()
calculate(nrOfWorkers = 4, nrOfElements = 10000, nrOfMessages = 10000)
@ -55,10 +58,10 @@ object Pi extends App {
var start: Long = _
// create the workers
val workers = Vector.fill(nrOfWorkers)(actorOf[Worker])
val workers = Vector.fill(nrOfWorkers)(app.createActor[Worker])
// wrap them with a load-balancing router
val router = Routing.actorOf(RoutedProps().withRoundRobinRouter.withConnections(workers), "pi")
val router = app.routing.actorOf(RoutedProps().withRoundRobinRouter.withConnections(workers), "pi")
// message handler
def receive = {
@ -101,7 +104,7 @@ object Pi extends App {
val latch = new CountDownLatch(1)
// create the master
val master = actorOf(new Master(nrOfWorkers, nrOfMessages, nrOfElements, latch))
val master = app.createActor(new Master(nrOfWorkers, nrOfMessages, nrOfElements, latch))
// start the calculation
master ! Calculate