August 2018
Intermediate to advanced
380 pages
10h 2m
English
Every actor has a mailbox, where any other messages can be sent. Akka guarantees that the messages are handled by the actor one at a time, and no concurrent handling happens. In fact, the actor model provides a guarantee that no more than one thread accesses the internal state of an actor at a time. However, keep in mind that it is up to the programmer to follow the actor model precisely. It is easy to break the model by spawning extra threads (e.g. with a Future) in an actor, thus breaking the single-threaded access guarantee.
This restriction is essential to enforce in the presence of other convenient concurrency libraries, such as Future. Akka works hand-in-hand with Scala Future. It is important to remember that futures start ...