Ensure proper cleanup even if postStop throws an exception.

This commit is contained in:
Martin Krasser 2011-03-01 11:57:00 +01:00
parent 2aa8cb161b
commit 20ccd0230e

View file

@ -656,15 +656,18 @@ class LocalActorRef private[akka] (
cancelReceiveTimeout
dispatcher.detach(this)
_status = ActorRefInternals.SHUTDOWN
actor.postStop
currentMessage = null
Actor.registry.unregister(this)
if (isRemotingEnabled) {
if (isClientManaged_?)
Actor.remote.unregisterClientManagedActor(homeAddress.get.getHostName, homeAddress.get.getPort, uuid)
Actor.remote.unregister(this)
try {
actor.postStop
} finally {
currentMessage = null
Actor.registry.unregister(this)
if (isRemotingEnabled) {
if (isClientManaged_?)
Actor.remote.unregisterClientManagedActor(homeAddress.get.getHostName, homeAddress.get.getPort, uuid)
Actor.remote.unregister(this)
}
setActorSelfFields(actorInstance.get,null)
}
setActorSelfFields(actorInstance.get,null)
} //else if (isBeingRestarted) throw new ActorKilledException("Actor [" + toString + "] is being restarted.")
}