Add UID to RemoteActorRef, see #3072
* Sending to a previous incarnation of an actor shall fail, to make remote actors work the same way as local ones (in the sense that after Terminated() the ref is not working anymore) * Changed equality of ActorRef to take the uid into account * Parse uid fragment in RelativeActorPath and ActorPathExtractor * Handle uid in getChild and in RemoteSystemDaemon * Use toSerializationFormat and toSerializationFormatWithAddress in serialization * Replaced var uid in ActorCell and ChildRestartStats with constructor parameters (path) * Create the uid in one single place, in makeChild in parent * Handle ActorRef with and without uid in DeathWatch * Optimize ActorPath.toString and friends * Update documentation and migration guide
This commit is contained in:
parent
eb10fac787
commit
b738487dc8
37 changed files with 607 additions and 186 deletions
|
|
@ -67,8 +67,8 @@ public class SerializationDocTestBase {
|
|||
// within a piece of code that sets it,
|
||||
// so either you need to supply your own,
|
||||
// or simply use the local path.
|
||||
if (transportAddress == null) identifier = theActorRef.path().toString();
|
||||
else identifier = theActorRef.path().toStringWithAddress(transportAddress);
|
||||
if (transportAddress == null) identifier = theActorRef.path().toSerializationFormat();
|
||||
else identifier = theActorRef.path().toSerializationFormatWithAddress(transportAddress);
|
||||
// Then just serialize the identifier however you like
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -120,9 +120,17 @@ you might want to know how to serialize and deserialize them properly, here's th
|
|||
|
||||
.. note::
|
||||
|
||||
``ActorPath.toStringWithAddress`` only differs from ``toString`` if the
|
||||
``ActorPath.toSerializationFormatWithAddress`` differs from ``toString`` if the
|
||||
address does not already have ``host`` and ``port`` components, i.e. it only
|
||||
inserts address information for local addresses.
|
||||
|
||||
``toSerializationFormatWithAddress`` also adds the unique id of the actor, which will
|
||||
change when the actor is stopped and then created again with the same name.
|
||||
Sending messages to a reference pointing the old actor will not be delivered
|
||||
to the new actor. If you do not want this behavior, e.g. in case of long term
|
||||
storage of the reference, you can use ``toStringWithAddress``, which does not
|
||||
include the unique id.
|
||||
|
||||
|
||||
This assumes that serialization happens in the context of sending a message
|
||||
through the remote transport. There are other uses of serialization, though,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue