log failures in postStop, see #2928
This commit is contained in:
parent
40a67a4097
commit
a80b5269e6
2 changed files with 13 additions and 1 deletions
|
|
@ -119,6 +119,16 @@ class ActorLifeCycleSpec extends AkkaSpec with BeforeAndAfterEach with ImplicitS
|
|||
system.stop(supervisor)
|
||||
}
|
||||
|
||||
"log failues in postStop" in {
|
||||
val a = system.actorOf(Props(new Actor {
|
||||
def receive = Actor.emptyBehavior
|
||||
override def postStop { throw new Exception("hurrah") }
|
||||
}))
|
||||
EventFilter[Exception]("hurrah", occurrences = 1) intercept {
|
||||
a ! PoisonPill
|
||||
}
|
||||
}
|
||||
|
||||
"clear the behavior stack upon restart" in {
|
||||
case class Become(recv: ActorContext ⇒ Receive)
|
||||
val a = system.actorOf(Props(new Actor {
|
||||
|
|
|
|||
|
|
@ -199,7 +199,9 @@ private[akka] trait FaultHandling { this: ActorCell ⇒
|
|||
* specific order.
|
||||
*/
|
||||
try if (a ne null) a.postStop()
|
||||
finally try dispatcher.detach(this)
|
||||
catch {
|
||||
case NonFatal(e) ⇒ publish(Error(e, self.path.toString, clazz(a), e.getMessage))
|
||||
} finally try dispatcher.detach(this)
|
||||
finally try parent.sendSystemMessage(ChildTerminated(self))
|
||||
finally try parent ! NullMessage // read ScalaDoc of NullMessage to see why
|
||||
finally try tellWatchersWeDied(a)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue