Perform Terminate removeChild under the terminating lock also, see #2552

This commit is contained in:
Patrik Nordwall 2012-09-27 14:28:40 +02:00
parent 2b5eb67991
commit 2e343eca24

View file

@ -82,15 +82,17 @@ private[akka] class RemoteSystemDaemon(system: ActorSystemImpl, _path: ActorPath
}
case Terminated(child: ActorRefWithCell) if child.asInstanceOf[ActorRefScope].isLocal
removeChild(child.path.elements.drop(1).mkString("/"))
terminationHookDoneWhenNoChildren()
terminating.locked {
removeChild(child.path.elements.drop(1).mkString("/"))
terminationHookDoneWhenNoChildren()
}
case t: Terminated
case TerminationHook
terminating.switchOn {
terminationHookDoneWhenNoChildren()
foreachChild { system.stop(_) }
foreachChild { system.stop }
}
case AddressTerminated(address)
@ -99,7 +101,8 @@ private[akka] class RemoteSystemDaemon(system: ActorSystemImpl, _path: ActorPath
case unknown log.warning("Unknown message {} received by {}", unknown, this)
}
def terminationHookDoneWhenNoChildren(): Unit = if (terminating.isOn && !hasChildren)
system.provider.systemGuardian.tell(TerminationHookDone, this)
def terminationHookDoneWhenNoChildren(): Unit = terminating.whileOn {
if (!hasChildren) system.provider.systemGuardian.tell(TerminationHookDone, this)
}
}