Make sure dispatcher isnt changed on actor restart
This commit is contained in:
parent
35cc621863
commit
a23159fece
1 changed files with 4 additions and 3 deletions
|
|
@ -742,9 +742,11 @@ class LocalActorRef private[akka](
|
|||
* Sets the dispatcher for this actor. Needs to be invoked before the actor is started.
|
||||
*/
|
||||
def dispatcher_=(md: MessageDispatcher): Unit = guard.withGuard {
|
||||
if (!isRunning || isBeingRestarted) _dispatcher = md
|
||||
else throw new ActorInitializationException(
|
||||
if (!isBeingRestarted) {
|
||||
if (!isRunning) _dispatcher = md
|
||||
else throw new ActorInitializationException(
|
||||
"Can not swap dispatcher for " + toString + " after it has been started")
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -1141,7 +1143,6 @@ class LocalActorRef private[akka](
|
|||
freshActor.initTransactionalState
|
||||
actorInstance.set(freshActor)
|
||||
if (failedActor.isInstanceOf[TypedActor]) failedActor.asInstanceOf[TypedActor].swapInstanceInProxy(freshActor)
|
||||
if (dispatcher.isShutdown) dispatcher.start
|
||||
Actor.log.debug("Invoking 'postRestart' for new actor instance [%s].", id)
|
||||
freshActor.postRestart(reason)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue