Merged with current master

This commit is contained in:
Viktor Klang 2011-12-13 10:04:43 +01:00
commit bf01045779
144 changed files with 6879 additions and 8250 deletions

View file

@ -26,7 +26,7 @@ class MyActor extends Actor {
}
//#my-actor
case class DoIt(msg: Message)
case class DoIt(msg: ImmutableMessage)
case class Message(s: String)
//#context-actorOf
@ -43,7 +43,7 @@ class FirstActor extends Actor {
sender ! replyMsg
self.stop()
}
def doSomeDangerousWork(msg: Message): String = { "done" }
def doSomeDangerousWork(msg: ImmutableMessage): String = { "done" }
}) ! m
case replyMsg: String sender ! replyMsg
@ -54,9 +54,29 @@ class FirstActor extends Actor {
//#system-actorOf
object Main extends App {
val system = ActorSystem("MySystem")
val myActor = system.actorOf[FirstActor]
val myActor = system.actorOf[MyActor]
//#system-actorOf
}
class ReplyException extends Actor {
def receive = {
case _
//#reply-exception
try {
val result = operation()
sender ! result
} catch {
case e: Exception
sender ! akka.actor.Status.Failure(e)
throw e
}
//#reply-exception
}
def operation(): String = { "Hi" }
}
//#swapper
case object Swap
class Swapper extends Actor {
@ -169,7 +189,7 @@ class ActorDocSpec extends AkkaSpec(Map("akka.loglevel" -> "INFO")) {
"creating actor with Props" in {
//#creating-props
import akka.actor.Props
val dispatcher = system.dispatcherFactory.fromConfig("my-dispatcher")
val dispatcher = system.dispatcherFactory.newFromConfig("my-dispatcher")
val myActor = system.actorOf(Props[MyActor].withDispatcher(dispatcher), name = "myactor")
//#creating-props
@ -230,6 +250,9 @@ class ActorDocSpec extends AkkaSpec(Map("akka.loglevel" -> "INFO")) {
}
}
//#hot-swap-actor
val actor = system.actorOf(new HotSwapActor)
}
}