I was trying out some Akka stuff where an Actor mutates state in a Future. Here is the complete source code!
When I tested the above, I get the following output:
Even though the counter is incremented in a Future, which eventually executes in a different
thread, the order in which the increment happens is preserved and deterministic. Now I modified my receive method as below:
When I run the tests now, the order of increment is non-deterministic:
What I don't get is what effect the context become has on mutating the state of the actor?