Cleaning up the ActorRef serialization according to review. See #3137

This commit is contained in:
Björn Antonsson 2013-03-26 11:25:09 +01:00
parent 33080a4155
commit a4ab7a9841
18 changed files with 100 additions and 100 deletions

View file

@ -57,17 +57,8 @@ public class SerializationDocTestBase {
//#actorref-serializer
// Serialize
// (beneath toBinary)
final SerializationInformation info = Serialization.currentTransportInformation().value();
String identifier = Serialization.serializedActorPath(theActorRef);
String identifier;
// If there is no SerializationInformation,
// it means that this Serializer isn't called
// within a piece of code that sets it,
// so either you need to supply your own,
// or simply use the local path.
if (info == null) identifier = theActorRef.path().toSerializationFormat();
else identifier = Serialization.serializedActorPath(theActorRef);
// Then just serialize the identifier however you like
// Deserialize
@ -116,16 +107,20 @@ public class SerializationDocTestBase {
}
//#external-address
public void demonstrateExternalAddress() {
// this is not meant to be run, only to be compiled
static
//#external-address
public class ExternalAddressExample {
//#external-address
final ActorSystem system = ActorSystem.create();
final Address remoteAddr = new Address("", "");
// #external-address
final Address addr = ExternalAddress.ID.get(system).getAddressFor(remoteAddr);
// #external-address
//#external-address
public String serializeTo(ActorRef ref, Address remote) {
return ref.path().toSerializationFormatWithAddress(
ExternalAddress.ID.get(system).getAddressFor(remote));
}
}
//#external-address
static
//#external-address-default
public class DefaultAddressExt implements Extension {