Skip to Content
Mastering Functional Programming
book

Mastering Functional Programming

by Anatolii Kmetiuk
August 2018
Intermediate to advanced
380 pages
10h 2m
English
Packt Publishing
Content preview from Mastering Functional Programming

No leaking of mutable state

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 ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Learning Functional Programming

Learning Functional Programming

Jack Widman

Publisher Resources

ISBN: 9781788620796Supplemental Content