Merge pull request #17888 from akka/wip-17805-clearActorFields-patriknw
=act #17805 Don't change self on restart"
This commit is contained in:
commit
7bfc56f3f0
3 changed files with 10 additions and 7 deletions
|
|
@ -567,7 +567,7 @@ private[akka] class ActorCell(
|
|||
protected def create(failure: Option[ActorInitializationException]): Unit = {
|
||||
def clearOutActorIfNonNull(): Unit = {
|
||||
if (actor != null) {
|
||||
clearActorFields(actor)
|
||||
clearActorFields(actor, recreate = false)
|
||||
actor = null // ensure that we know that we failed during creation
|
||||
}
|
||||
}
|
||||
|
|
@ -640,8 +640,8 @@ private[akka] class ActorCell(
|
|||
throw new IllegalArgumentException("ActorCell has no props field")
|
||||
}
|
||||
|
||||
final protected def clearActorFields(actorInstance: Actor): Unit = {
|
||||
setActorFields(actorInstance, context = null, self = system.deadLetters)
|
||||
final protected def clearActorFields(actorInstance: Actor, recreate: Boolean): Unit = {
|
||||
setActorFields(actorInstance, context = null, self = if (recreate) self else system.deadLetters)
|
||||
currentMessage = null
|
||||
behaviorStack = emptyBehaviorStack
|
||||
}
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ private[akka] trait FaultHandling { this: ActorCell ⇒
|
|||
val ex = new PreRestartException(self, e, cause, optionalMessage)
|
||||
publish(Error(ex, self.path.toString, clazz(failedActor), e.getMessage))
|
||||
} finally {
|
||||
clearActorFields(failedActor)
|
||||
clearActorFields(failedActor, recreate = true)
|
||||
}
|
||||
}
|
||||
assert(mailbox.isSuspended, "mailbox must be suspended during restart, status=" + mailbox.currentStatus)
|
||||
|
|
@ -217,7 +217,7 @@ private[akka] trait FaultHandling { this: ActorCell ⇒
|
|||
if (system.settings.DebugLifecycle)
|
||||
publish(Debug(self.path.toString, clazz(a), "stopped"))
|
||||
|
||||
clearActorFields(a)
|
||||
clearActorFields(a, recreate = false)
|
||||
clearActorCellFields(this)
|
||||
actor = null
|
||||
}
|
||||
|
|
@ -245,7 +245,7 @@ private[akka] trait FaultHandling { this: ActorCell ⇒
|
|||
publish(Error(e, self.path.toString, clazz(freshActor), "restarting " + child))
|
||||
})
|
||||
} catch handleNonFatalOrInterruptedException { e ⇒
|
||||
clearActorFields(actor) // in order to prevent preRestart() from happening again
|
||||
clearActorFields(actor, recreate = false) // in order to prevent preRestart() from happening again
|
||||
handleInvokeFailure(survivors, new PostRestartException(self, e, cause))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -537,7 +537,10 @@ object MiMa extends AutoPlugin {
|
|||
FilterAnyProblem("akka.remote.RemoteWatcher$Stats"),
|
||||
|
||||
// toString is available on any object, mima is confused due to a generated toString appearing #17722
|
||||
ProblemFilters.exclude[MissingMethodProblem]("akka.japi.Pair.toString")
|
||||
ProblemFilters.exclude[MissingMethodProblem]("akka.japi.Pair.toString"),
|
||||
|
||||
// #17805
|
||||
ProblemFilters.exclude[MissingMethodProblem]("akka.actor.ActorCell.clearActorFields")
|
||||
|
||||
)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue