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 case Terminated(child: ActorRefWithCell) if child.asInstanceOf[ActorRefScope].isLocal
removeChild(child.path.elements.drop(1).mkString("/")) terminating.locked {
terminationHookDoneWhenNoChildren() removeChild(child.path.elements.drop(1).mkString("/"))
terminationHookDoneWhenNoChildren()
}
case t: Terminated case t: Terminated
case TerminationHook case TerminationHook
terminating.switchOn { terminating.switchOn {
terminationHookDoneWhenNoChildren() terminationHookDoneWhenNoChildren()
foreachChild { system.stop(_) } foreachChild { system.stop }
} }
case AddressTerminated(address) 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) case unknown log.warning("Unknown message {} received by {}", unknown, this)
} }
def terminationHookDoneWhenNoChildren(): Unit = if (terminating.isOn && !hasChildren) def terminationHookDoneWhenNoChildren(): Unit = terminating.whileOn {
system.provider.systemGuardian.tell(TerminationHookDone, this) if (!hasChildren) system.provider.systemGuardian.tell(TerminationHookDone, this)
}
} }