Merged with master

This commit is contained in:
Viktor Klang 2013-04-03 16:21:22 +02:00
commit 6976317bc7
35 changed files with 259 additions and 166 deletions

View file

@ -7,7 +7,6 @@ import org.junit.Test;
import static org.junit.Assert.*;
//#imports
import akka.actor.*;
import akka.remote.RemoteActorRefProvider;
import akka.serialization.*;
//#imports
@ -58,20 +57,10 @@ public class SerializationDocTestBase {
//#actorref-serializer
// Serialize
// (beneath toBinary)
final Address transportAddress =
Serialization.currentTransportAddress().value();
String identifier;
String identifier = Serialization.serializedActorPath(theActorRef);
// If there is no transportAddress,
// it means that either 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 (transportAddress == null) identifier = theActorRef.path().toSerializationFormat();
else identifier = theActorRef.path().toSerializationFormatWithAddress(transportAddress);
// Then just serialize the identifier however you like
// Deserialize
// (beneath fromBinary)
final ActorRef deserializedActorRef = theActorSystem.actorFor(identifier);
@ -118,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 {