move Java code snippet into compiled class

This commit is contained in:
Roland 2012-02-06 12:59:03 +01:00
parent 96486428e1
commit 4e12b72959
2 changed files with 16 additions and 3 deletions

View file

@ -68,4 +68,18 @@ public class RouterViaProgramExample {
router3.tell(new ExampleActor.Message(i)); router3.tell(new ExampleActor.Message(i));
} }
} }
private class CompileCheckJavaDocsForRouting extends UntypedActor {
@Override
public void onReceive(Object o) {
//#reply-with-parent
getSender().tell("reply", getContext().parent()); // replies go to router
//#reply-with-parent
//#reply-with-self
getSender().tell("reply", getSelf()); // replies go to this actor
//#reply-with-self
}
}
} }

View file

@ -87,10 +87,9 @@ deterministic fashion. Since each actor knows its own external representation
as well as that of its parent, the routees decide where replies should be sent as well as that of its parent, the routees decide where replies should be sent
when reacting to a message: when reacting to a message:
.. code-block:: java .. includecode:: code/akka/docs/jrouting/RouterViaProgramExample.java#reply-with-parent
getSender().tell(reply, getContext().parent()); // replies go to the router .. includecode:: code/akka/docs/jrouting/RouterViaProgramExample.java#reply-with-self
getSender().tell(reply, getSelf()); // replies go to this routee
It is apparent now why routing needs to be enabled in code rather than being It is apparent now why routing needs to be enabled in code rather than being
possible to “bolt on” later: whether or not an actor is routed means a change possible to “bolt on” later: whether or not an actor is routed means a change