diff --git a/akka-actor/src/main/scala/actor/ActorRef.scala b/akka-actor/src/main/scala/actor/ActorRef.scala index e680f13c58..0ec35ab9b4 100644 --- a/akka-actor/src/main/scala/actor/ActorRef.scala +++ b/akka-actor/src/main/scala/actor/ActorRef.scala @@ -82,7 +82,6 @@ trait ActorRef extends @volatile protected[this] var _status: ActorRefStatus.StatusType = ActorRefStatus.UNSTARTED @volatile protected[akka] var _homeAddress = new InetSocketAddress(RemoteServerModule.HOSTNAME, RemoteServerModule.PORT) @volatile protected[akka] var _futureTimeout: Option[ScheduledFuture[AnyRef]] = None - @volatile protected[akka] var registeredInRemoteNodeDuringSerialization = false protected[akka] val guard = new ReentrantGuard /** diff --git a/akka-remote/src/main/scala/remote/RemoteServer.scala b/akka-remote/src/main/scala/remote/RemoteServer.scala index fadc5ce60a..bed9e9f933 100644 --- a/akka-remote/src/main/scala/remote/RemoteServer.scala +++ b/akka-remote/src/main/scala/remote/RemoteServer.scala @@ -337,8 +337,8 @@ class RemoteServer extends Logging with ListenerManagement { def unregister(actorRef: ActorRef):Unit = synchronized { if (_isRunning) { log.debug("Unregistering server side remote actor [%s] with id [%s:%s]", actorRef.actorClass.getName, actorRef.id, actorRef.uuid) - actors() remove actorRef.id - if (actorRef.registeredInRemoteNodeDuringSerialization) actorsByUuid() remove actorRef.uuid + actors().remove(actorRef.id,actorRef) + actorsByUuid().remove(actorRef.uuid,actorRef) } } @@ -353,11 +353,9 @@ class RemoteServer extends Logging with ListenerManagement { if (id.startsWith(UUID_PREFIX)) { actorsByUuid().remove(id.substring(UUID_PREFIX.length)) } else { - val actorRef = actors().get(id) - if (actorRef.registeredInRemoteNodeDuringSerialization) { - actorsByUuid() remove actorRef.uuid - } - actors() remove id + val actorRef = actors() get id + actorsByUuid().remove(actorRef.uuid,actorRef) + actors().remove(id,actorRef) } } } diff --git a/akka-remote/src/main/scala/serialization/SerializationProtocol.scala b/akka-remote/src/main/scala/serialization/SerializationProtocol.scala index 0e7f5ce732..c07417c0e2 100644 --- a/akka-remote/src/main/scala/serialization/SerializationProtocol.scala +++ b/akka-remote/src/main/scala/serialization/SerializationProtocol.scala @@ -249,12 +249,9 @@ object RemoteActorSerialization { val host = homeAddress.getHostName val port = homeAddress.getPort - if (!registeredInRemoteNodeDuringSerialization) { - Actor.log.debug("Register serialized Actor [%s] as remote @ [%s:%s]", actorClass.getName, host, port) - RemoteServer.getOrCreateServer(homeAddress) - RemoteServer.registerActorByUuid(homeAddress, uuid.toString, ar) - registeredInRemoteNodeDuringSerialization = true - } + Actor.log.debug("Register serialized Actor [%s] as remote @ [%s:%s]", actorClass.getName, host, port) + RemoteServer.getOrCreateServer(homeAddress) + RemoteServer.registerActorByUuid(homeAddress, uuid.toString, ar) RemoteActorRefProtocol.newBuilder .setClassOrServiceName(uuid.toString)