Merge pull request #561 from akka/wip-2101-stash-docs-phaller

Stash docs (#2101)
This commit is contained in:
Viktor Klang (√) 2012-07-05 17:33:15 -07:00
commit b6a5796218
5 changed files with 157 additions and 1 deletions

View file

@ -300,6 +300,26 @@ class ActorDocSpec extends AkkaSpec(Map("akka.loglevel" -> "INFO")) {
val actor = system.actorOf(Props(new HotSwapActor), name = "hot")
}
"using Stash" in {
//#stash
import akka.actor.Stash
class ActorWithProtocol extends Actor with Stash {
def receive = {
case "open"
unstashAll()
context.become {
case "write" // do writing...
case "close"
unstashAll()
context.unbecome()
case msg stash()
}
case msg stash()
}
}
//#stash
}
"using watch" in {
//#watch
import akka.actor.{ Actor, Props, Terminated }