Merge branch 'wip-2134-deathwatch2.0-√' of github.com:akka/akka into wip-2134-deathwatch2.0-√

This commit is contained in:
Viktor Klang 2012-06-02 14:20:12 +02:00
commit e461e1490d
2 changed files with 15 additions and 14 deletions

View file

@ -502,8 +502,6 @@ class LocalActorRefProvider(
def init(_system: ActorSystemImpl) { def init(_system: ActorSystemImpl) {
system = _system system = _system
// chain death watchers so that killing guardian stops the application // chain death watchers so that killing guardian stops the application
//guardian.sendSystemMessage(Watch(systemGuardian, guardian))
//rootGuardian.sendSystemMessage(Watch(rootGuardian, systemGuardian))
guardian.sendSystemMessage(Watch(guardian, systemGuardian)) guardian.sendSystemMessage(Watch(guardian, systemGuardian))
rootGuardian.sendSystemMessage(Watch(systemGuardian, rootGuardian)) rootGuardian.sendSystemMessage(Watch(systemGuardian, rootGuardian))
eventStream.startDefaultLoggers(_system) eventStream.startDefaultLoggers(_system)

View file

@ -246,21 +246,24 @@ private[akka] final class PromiseActorRef private (val provider: ActorRefProvide
override def !(message: Any)(implicit sender: ActorRef = null): Unit = state match { override def !(message: Any)(implicit sender: ActorRef = null): Unit = state match {
case Stopped | _: StoppedWithPath provider.deadLetters ! message case Stopped | _: StoppedWithPath provider.deadLetters ! message
case _ case _ if (!(result.tryComplete {
val completedJustNow = result.tryComplete {
message match { message match {
case Status.Success(r) Right(r) case Status.Success(r) Right(r)
case Status.Failure(f) Left(f) case Status.Failure(f) Left(f)
case other Right(other) case other Right(other)
} }
} })) provider.deadLetters ! message
if (!completedJustNow) provider.deadLetters ! message
} }
override def sendSystemMessage(message: SystemMessage): Unit = message match { override def sendSystemMessage(message: SystemMessage): Unit = message match {
case _: Terminate stop() case _: Terminate stop()
case Watch(watchee, watcher) if (watchee == this && watcher != this && !addWatcher(watcher)) watcher ! Terminated(watchee)(stopped = true) case Watch(watchee, watcher)
case Unwatch(watchee, watcher) if (watchee == this && watcher != this) remWatcher(watcher) if (watchee == this && watcher != this) {
if (!addWatcher(watcher)) watcher ! Terminated(watchee)(stopped = true)
} else System.err.println("BUG: illegal Watch(%s,%s) for %s".format(watchee, watcher, this))
case Unwatch(watchee, watcher)
if (watchee == this && watcher != this) remWatcher(watcher)
else System.err.println("BUG: illegal Unwatch(%s,%s) for %s".format(watchee, watcher, this))
case _ case _
} }