java docs for Artery, #21209

* and a few other things
* fixed some remaining akka.tcp
This commit is contained in:
Patrik Nordwall 2016-09-30 18:20:47 +02:00
parent 4a4f9c76f9
commit 7af814d3df
13 changed files with 848 additions and 39 deletions

View file

@ -30,7 +30,8 @@ public class ByteBufferSerializerDocTest {
@Override
public byte[] toBinary(Object o) {
final ByteBuffer buf = ByteBuffer.allocate(256); // in production code, aquire this from a BufferPool
// in production code, aquire this from a BufferPool
final ByteBuffer buf = ByteBuffer.allocate(256);
toBinary(o, buf);
buf.flip();
@ -56,5 +57,23 @@ public class ByteBufferSerializerDocTest {
}
}
//#bytebufserializer-with-manifest
static class OnlyForDocInclude {
static
//#ByteBufferSerializer-interface
interface ByteBufferSerializer {
/**
* Serializes the given object into the `ByteBuffer`.
*/
void toBinary(Object o, ByteBuffer buf);
/**
* Produces an object from a `ByteBuffer`, with an optional type-hint;
* the class should be loaded using ActorSystem.dynamicAccess.
*/
void fromBinary(ByteBuffer buf, String manifest);
}
//#ByteBufferSerializer-interface
}
}

View file

@ -446,6 +446,18 @@ public class RouterDocTest extends AbstractJavaTest {
//#remoteRoutees
}
// only compile
public void demonstrateRemoteDeployWithArtery() {
//#remoteRoutees-artery
Address[] addresses = {
new Address("akka", "remotesys", "otherhost", 1234),
AddressFromURIString.parse("akka://othersys@anotherhost:1234")};
ActorRef routerRemote = system.actorOf(
new RemoteRouterConfig(new RoundRobinPool(5), addresses).props(
Props.create(Echo.class)));
//#remoteRoutees-artery
}
@Test
public void demonstrateSupervisor() {
//#supervision

View file

@ -35,6 +35,14 @@ public class RemoteDeploymentDocTest {
private final ActorSystem system = actorSystemResource.getSystem();
@SuppressWarnings("unused")
void makeAddress() {
//#make-address-artery
Address addr = new Address("akka", "sys", "host", 1234);
addr = AddressFromURIString.parse("akka://sys@host:1234"); // the same
//#make-address-artery
}
@Test
public void demonstrateDeployment() {
//#make-address
@ -63,6 +71,11 @@ public class RemoteDeploymentDocTest {
ConfigFactory.parseString("akka.remote.netty.tcp.hostname=\"1.2.3.4\"")
.withFallback(ConfigFactory.load());
//#programmatic
//#programmatic-artery
ConfigFactory.parseString("akka.remote.artery.canonical.hostname=\"1.2.3.4\"")
.withFallback(ConfigFactory.load());
//#programmatic-artery
}