Removed all 'actorOf' methods that does not take a 'Props', and changed all callers to use 'actorOf(Props(..))'
Signed-off-by: Jonas Bonér <jonas@jonasboner.com>
This commit is contained in:
parent
86a5114d79
commit
c9b787f029
85 changed files with 464 additions and 518 deletions
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
package akka.tutorial.first.java;
|
||||
|
||||
import akka.actor.Props;
|
||||
import akka.actor.ActorRef;
|
||||
import akka.actor.ActorSystem;
|
||||
import akka.actor.InternalActorRef;
|
||||
|
|
@ -112,7 +113,7 @@ public class Pi {
|
|||
};
|
||||
LinkedList<ActorRef> actors = new LinkedList<ActorRef>() {
|
||||
{
|
||||
for (int i = 0; i < nrOfWorkers; i++) add(getContext().actorOf(Worker.class));
|
||||
for (int i = 0; i < nrOfWorkers; i++) add(getContext().actorOf(new Props(Worker.class)));
|
||||
}
|
||||
};
|
||||
// FIXME routers are intended to be used like this
|
||||
|
|
@ -166,11 +167,11 @@ public class Pi {
|
|||
final CountDownLatch latch = new CountDownLatch(1);
|
||||
|
||||
// create the master
|
||||
ActorRef master = system.actorOf(new UntypedActorFactory() {
|
||||
ActorRef master = system.actorOf(new Props(new UntypedActorFactory() {
|
||||
public UntypedActor create() {
|
||||
return new Master(nrOfWorkers, nrOfMessages, nrOfElements, latch);
|
||||
}
|
||||
});
|
||||
}));
|
||||
|
||||
// start the calculation
|
||||
master.tell(new Calculate());
|
||||
|
|
|
|||
|
|
@ -5,8 +5,7 @@ package akka.tutorial.first.scala
|
|||
|
||||
import java.util.concurrent.CountDownLatch
|
||||
import akka.routing.{ RoutedActorRef, LocalConnectionManager, RoundRobinRouter, RoutedProps }
|
||||
import akka.actor.{ ActorSystemImpl, Actor, ActorSystem }
|
||||
import akka.actor.InternalActorRef
|
||||
import akka.actor._
|
||||
|
||||
object Pi extends App {
|
||||
|
||||
|
|
@ -53,7 +52,7 @@ object Pi extends App {
|
|||
var start: Long = _
|
||||
|
||||
// create the workers
|
||||
val workers = Vector.fill(nrOfWorkers)(context.actorOf[Worker])
|
||||
val workers = Vector.fill(nrOfWorkers)(context.actorOf(Props[Worker]))
|
||||
|
||||
// wrap them with a load-balancing router
|
||||
// FIXME routers are intended to be used like this
|
||||
|
|
@ -99,7 +98,7 @@ object Pi extends App {
|
|||
val latch = new CountDownLatch(1)
|
||||
|
||||
// create the master
|
||||
val master = system.actorOf(new Master(nrOfWorkers, nrOfMessages, nrOfElements, latch))
|
||||
val master = system.actorOf(Props(new Master(nrOfWorkers, nrOfMessages, nrOfElements, latch)))
|
||||
|
||||
// start the calculation
|
||||
master ! Calculate
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue