#2934 - explaining send a bit better in the docs

This commit is contained in:
Viktor Klang 2013-01-27 21:47:05 +01:00
parent 68f3dd549d
commit 791bbd1565
3 changed files with 10 additions and 11 deletions

View file

@ -55,10 +55,12 @@ public class AgentDocTest {
Agent<Integer> agent = new Agent<Integer>(5, ec);
//#send
// send a value
// send a value, enqueues this change
// of the value of the Agent
agent.send(7);
// send a function
// send a Mapper, enqueues this change
// to the value of the Agent
agent.send(new Mapper<Integer, Integer>() {
public Integer apply(Integer i) {
return i * 2;

View file

@ -48,10 +48,12 @@ class AgentDocSpec extends AkkaSpec {
"send and sendOff" in {
val agent = Agent(0)(ExecutionContext.global)
//#send
// send a value
// send a value, enqueues this change
// of the value of the Agent
agent send 7
// send a function
// send a function, enqueues this change
// to the value of the Agent
agent send (_ + 1)
agent send (_ * 2)
//#send