Remove try ... catch constructs around invokations of tell, see #2870

This commit is contained in:
Patrik Nordwall 2013-01-29 16:10:46 +01:00
parent 1c9c4ea8f0
commit f9611178a3
3 changed files with 9 additions and 9 deletions

View file

@ -78,9 +78,7 @@ private[akka] trait DeathWatch { this: ActorCell ⇒
if (!watching.isEmpty) { if (!watching.isEmpty) {
try { try {
watching foreach { // ➡➡➡ NEVER SEND THE SAME SYSTEM MESSAGE OBJECT TO TWO ACTORS ⬅⬅⬅ watching foreach { // ➡➡➡ NEVER SEND THE SAME SYSTEM MESSAGE OBJECT TO TWO ACTORS ⬅⬅⬅
case watchee: InternalActorRef try watchee.sendSystemMessage(Unwatch(watchee, self)) catch { case watchee: InternalActorRef watchee.sendSystemMessage(Unwatch(watchee, self))
case NonFatal(t) publish(Error(t, self.path.toString, clazz(actor), "deathwatch"))
}
} }
} finally { } finally {
watching = ActorCell.emptyActorRefSet watching = ActorCell.emptyActorRefSet

View file

@ -56,9 +56,7 @@ private[remote] class DefaultMessageDispatcher(private val system: ExtendedActor
if (LogReceive) log.debug("received daemon message {}", msgLog) if (LogReceive) log.debug("received daemon message {}", msgLog)
payload match { payload match {
case m @ (_: DaemonMsg | _: Terminated) case m @ (_: DaemonMsg | _: Terminated)
try remoteDaemon ! m catch { remoteDaemon ! m
case NonFatal(e) log.error(e, "exception while processing remote command {} from {}", m, sender)
}
case x log.debug("remoteDaemon received illegal message {} from {}", x, sender) case x log.debug("remoteDaemon received illegal message {} from {}", x, sender)
} }
} }

View file

@ -5,6 +5,7 @@
package akka.remote package akka.remote
import scala.annotation.tailrec 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.actor.{ VirtualPathContainer, Terminated, Deploy, Props, Nobody, LocalActorRef, InternalActorRef, Address, ActorSystemImpl, ActorRef, ActorPathExtractor, ActorPath, Actor, AddressTerminated }
import akka.event.LoggingAdapter import akka.event.LoggingAdapter
import akka.dispatch.Watch import akka.dispatch.Watch
@ -62,11 +63,11 @@ private[akka] class RemoteSystemDaemon(
} }
} }
override def !(msg: Any)(implicit sender: ActorRef = Actor.noSender): Unit = msg match { override def !(msg: Any)(implicit sender: ActorRef = Actor.noSender): Unit = try msg match {
case message: DaemonMsg case message: DaemonMsg
log.debug("Received command [{}] to RemoteSystemDaemon on [{}]", message, path.address) log.debug("Received command [{}] to RemoteSystemDaemon on [{}]", message, path.address)
message match { message match {
case DaemonMsgCreate(_, _, path, _) if untrustedMode log.debug("does not accept deployments (untrusted) for {}", path) case DaemonMsgCreate(_, _, path, _) if untrustedMode log.debug("does not accept deployments (untrusted) for [{}]", path)
case DaemonMsgCreate(props, deploy, path, supervisor) case DaemonMsgCreate(props, deploy, path, supervisor)
path match { path match {
case ActorPathExtractor(address, elems) if elems.nonEmpty && elems.head == "remote" case ActorPathExtractor(address, elems) if elems.nonEmpty && elems.head == "remote"
@ -107,7 +108,10 @@ private[akka] class RemoteSystemDaemon(
case _ // skip, this child doesn't belong to the terminated address case _ // skip, this child doesn't belong to the terminated address
} }
case unknown log.warning("Unknown message {} received by {}", unknown, this) case unknown log.warning("Unknown message [{}] received by [{}]", unknown, this)
} catch {
case NonFatal(e) log.error(e, "exception while processing remote command [{}] from [{}]", msg, sender)
} }
def terminationHookDoneWhenNoChildren(): Unit = terminating.whileOn { def terminationHookDoneWhenNoChildren(): Unit = terminating.whileOn {