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:
Jonas Bonér 2011-12-13 14:09:40 +01:00
parent 86a5114d79
commit c9b787f029
85 changed files with 464 additions and 518 deletions

View file

@ -6,7 +6,7 @@ package sample.fsm.dining.become
//Akka adaptation of
//http://www.dalnefre.com/wp/2010/08/dining-philosophers-in-humus/
import akka.actor.{ ActorRef, Actor, ActorSystem }
import akka.actor._
import akka.util.duration._
/*
@ -137,12 +137,12 @@ object DiningHakkers {
def run {
//Create 5 chopsticks
val chopsticks = for (i 1 to 5) yield system.actorOf[Chopstick]("Chopstick " + i)
val chopsticks = for (i 1 to 5) yield system.actorOf(Props[Chopstick], "Chopstick " + i)
//Create 5 awesome hakkers and assign them their left and right chopstick
val hakkers = for {
(name, i) List("Ghosh", "Bonér", "Klang", "Krasser", "Manie").zipWithIndex
} yield system.actorOf(new Hakker(name, chopsticks(i), chopsticks((i + 1) % 5)))
} yield system.actorOf(Props(new Hakker(name, chopsticks(i), chopsticks((i + 1) % 5))))
//Signal all hakkers that they should start thinking, and watch the show
hakkers.foreach(_ ! Think)

View file

@ -3,7 +3,7 @@
*/
package sample.fsm.dining.fsm
import akka.actor.{ ActorRef, Actor, FSM, ActorSystem }
import akka.actor._
import akka.actor.FSM._
import akka.util.Duration
import akka.util.duration._
@ -175,11 +175,11 @@ object DiningHakkersOnFsm {
def run = {
// Create 5 chopsticks
val chopsticks = for (i 1 to 5) yield system.actorOf[Chopstick]("Chopstick " + i)
val chopsticks = for (i 1 to 5) yield system.actorOf(Props[Chopstick], "Chopstick " + i)
// Create 5 awesome fsm hakkers and assign them their left and right chopstick
val hakkers = for {
(name, i) List("Ghosh", "Bonér", "Klang", "Krasser", "Manie").zipWithIndex
} yield system.actorOf(new FSMHakker(name, chopsticks(i), chopsticks((i + 1) % 5)))
} yield system.actorOf(Props(new FSMHakker(name, chopsticks(i), chopsticks((i + 1) % 5))))
hakkers.foreach(_ ! Think)
}

View file

@ -3,19 +3,19 @@
*/
package sample.hello
import akka.actor.{ ActorSystem, Actor }
import akka.actor.{ ActorSystem, Actor, Props }
case object Start
object Main {
def main(args: Array[String]): Unit = {
val system = ActorSystem()
system.actorOf[HelloActor] ! Start
system.actorOf(Props[HelloActor]) ! Start
}
}
class HelloActor extends Actor {
val worldActor = context.actorOf[WorldActor]
val worldActor = context.actorOf(Props[WorldActor])
def receive = {
case Start worldActor ! "Hello"
case s: String