Terminated is now a SystemMessage

This commit is contained in:
Endre Sándor Varga 2013-03-26 13:59:46 +01:00
parent 2c4c5b0594
commit 7b13ecea25
17 changed files with 82 additions and 69 deletions

View file

@ -8,7 +8,7 @@ import scala.annotation.tailrec
import scala.util.control.NonFatal
import akka.actor.{ VirtualPathContainer, Terminated, Deploy, Props, Nobody, LocalActorRef, InternalActorRef, Address, ActorSystemImpl, ActorRef, ActorPathExtractor, ActorPath, Actor, AddressTerminated }
import akka.event.LoggingAdapter
import akka.dispatch.sysmsg.Watch
import akka.dispatch.sysmsg.{ DeathWatchNotification, SystemMessage, Watch }
import akka.actor.ActorRefWithCell
import akka.actor.ActorRefScope
import akka.util.Switch
@ -80,6 +80,15 @@ private[akka] class RemoteSystemDaemon(
}
}
override def sendSystemMessage(message: SystemMessage): Unit = message match {
case DeathWatchNotification(child: ActorRefWithCell with ActorRefScope, _, _) if child.isLocal
terminating.locked {
removeChild(child.path.elements.drop(1).mkString("/"))
terminationHookDoneWhenNoChildren()
}
case _ super.sendSystemMessage(message)
}
override def !(msg: Any)(implicit sender: ActorRef = Actor.noSender): Unit = try msg match {
case message: DaemonMsg
log.debug("Received command [{}] to RemoteSystemDaemon on [{}]", message, path.address)
@ -126,12 +135,6 @@ private[akka] class RemoteSystemDaemon(
case Identify(messageId) sender ! ActorIdentity(messageId, Some(this))
case Terminated(child: ActorRefWithCell) if child.asInstanceOf[ActorRefScope].isLocal
terminating.locked {
removeChild(child.path.elements.drop(1).mkString("/"))
terminationHookDoneWhenNoChildren()
}
case t: Terminated
case TerminationHook