rework childrenRefs to make context.stop(child) fully asynchronous

- replace TreeMap with custom ChildrenContainer, which has three
  implementations: empty, normal and “terminating” (i.e. waiting for
  some child to terminate)
- split recreate() in the same way as terminate(), so that there is a
  phase during which the suspended actor waits for termination of all
  children which were stopped in preRestart
- do not null out “actor” in ActorCell during restart, because we do
  need the supervisionStrategy and nulling it out does not buy us much
  in this case anyway
- provide new ActorContext.suspendForChildTermination(), which enters
  limbo for as long there are outstanding termination requests; this
  enables code which is very similar to previously (half-working) setups
  with “synchronous” context.stop(child)

docs are still missing, plus a little polishing here and there; oh, and
before I forget: ActorCell NOW is 64 bytes again ;-)
This commit is contained in:
Roland 2012-02-29 21:10:31 +01:00
parent 4c8048588f
commit 64b523638e
13 changed files with 292 additions and 174 deletions

View file

@ -233,7 +233,7 @@ class ActorDocSpec extends AkkaSpec(Map("akka.loglevel" -> "INFO")) {
"creating actor with Props" in {
//#creating-props
import akka.actor.Props
val myActor = system.actorOf(Props[MyActor].withDispatcher("my-dispatcher"), name = "myactor")
val myActor = system.actorOf(Props[MyActor].withDispatcher("my-dispatcher"), name = "myactor2")
//#creating-props
system.stop(myActor)