August 2018
Intermediate to advanced
380 pages
10h 2m
English
Another thing that you must look out for when programming with Akka is leaking mutable state of the actors. Remember the previous principle that no more than a single thread must access the inner state of an actor? Well, if you send a reference to a mutable object that is owned by one actor to another one, this object may be accessed from two threads at a time in parallel. If you leak mutable state to other actors, you may end up with a worse headache than when starting a Future from an actor. In the case of starting a Future, at least you have control over that Future and the thread it started from; you can define some monitors and protocols to access the actor's state. Of course, you should not do it, but in ...