From ef03818ab107c64c970c702e06f90423c257c784 Mon Sep 17 00:00:00 2001 From: Patrik Nordwall Date: Fri, 27 Nov 2015 09:21:28 +0100 Subject: [PATCH] =act #19016 use the BackoffSupervisor as sender for parent msg --- .../src/main/scala/akka/pattern/BackoffSupervisor.scala | 7 ++++--- .../pattern/TransparentExponentialBackoffSupervisor.scala | 3 ++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/akka-actor/src/main/scala/akka/pattern/BackoffSupervisor.scala b/akka-actor/src/main/scala/akka/pattern/BackoffSupervisor.scala index 9bf86f7af1..65c7f794fc 100644 --- a/akka-actor/src/main/scala/akka/pattern/BackoffSupervisor.scala +++ b/akka-actor/src/main/scala/akka/pattern/BackoffSupervisor.scala @@ -148,8 +148,8 @@ object BackoffSupervisor { * message to this actor and it will reply with [[akka.pattern.BackoffSupervisor.CurrentChild]] * containing the `ActorRef` of the current child, if any. * - * The `BackoffSupervisor` forwards all messages from the child to the parent of the - * `BackoffSupervisor`. + * The `BackoffSupervisor`delegates all messages from the child to the parent of the + * `BackoffSupervisor`, with the supervisor as sender. * * The `BackoffSupervisor` forwards all other messages to the child, if it is currently running. * @@ -211,7 +211,8 @@ final class BackoffSupervisor( sender() ! CurrentChild(child) case msg if child.contains(sender()) ⇒ - context.parent.forward(msg) + // use the BackoffSupervisor as sender + context.parent ! msg case msg ⇒ child match { case Some(c) ⇒ c.forward(msg) diff --git a/akka-contrib/src/main/scala/akka/contrib/pattern/TransparentExponentialBackoffSupervisor.scala b/akka-contrib/src/main/scala/akka/contrib/pattern/TransparentExponentialBackoffSupervisor.scala index 7cf808337c..eac61896d0 100644 --- a/akka-contrib/src/main/scala/akka/contrib/pattern/TransparentExponentialBackoffSupervisor.scala +++ b/akka-contrib/src/main/scala/akka/contrib/pattern/TransparentExponentialBackoffSupervisor.scala @@ -195,7 +195,8 @@ class TransparentExponentialBackoffSupervisor( log.debug(s"Terminating, because child [$childRef] terminated itself") stop(self) case msg if sender() == childRef ⇒ - parent.forward(msg) + // use the supervisor as sender + context.parent ! msg case msg ⇒ childRef.forward(msg) }