Correctly serialize local actor refs from other actor systems. See #3137

This commit is contained in:
Björn Antonsson 2013-03-25 08:42:48 +01:00
parent 86fdfcd22f
commit 33080a4155
12 changed files with 151 additions and 89 deletions

View file

@ -271,8 +271,15 @@ private[akka] class RemoteActorRefProvider(
def actorFor(ref: InternalActorRef, path: String): InternalActorRef = path match {
case ActorPathExtractor(address, elems)
if (hasAddress(address)) actorFor(rootGuardian, elems)
else new RemoteActorRef(transport, transport.localAddressForRemote(address),
new RootActorPath(address) / elems, Nobody, props = None, deploy = None)
else try {
new RemoteActorRef(transport, transport.localAddressForRemote(address),
new RootActorPath(address) / elems, Nobody, props = None, deploy = None)
} catch {
case NonFatal(e)
val oldPath = RootActorPath(address) / elems
log.error(e, "Error while looking up address {}", oldPath.address)
new EmptyLocalActorRef(this, oldPath, eventStream)
}
case _ local.actorFor(ref, path)
}
@ -378,5 +385,5 @@ private[akka] class RemoteActorRef private[akka] (
def restart(cause: Throwable): Unit = sendSystemMessage(Recreate(cause))
@throws(classOf[java.io.ObjectStreamException])
private def writeReplace(): AnyRef = SerializedActorRef(path)
private def writeReplace(): AnyRef = SerializedActorRef(this)
}