Isolated Mutability

Before we can apply actors to our file exploring problem, we need to address one final issue—shared mutability. It’s common for programmers to create shared mutable variables and beat around with synchronization primitives to provide thread safety. Largely this has been a disaster. It’s hard to imagine getting concurrency right with the JDK library if the programmers haven’t mastered Brian Goetz’s Java Concurrency in Practice [Goe06]. But, once they master that book they soon realize that it’s hard to get concurrency right with the JDK library, period.

This is not a dismissal of the JDK for concurrency. After all, Akka and other libraries that support different concurrency models like the Software Transactional Memory—see ...

Get Pragmatic Scala now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.