O'Reilly logo

Learning Concurrent Programming in Scala by Aleksandar Prokopec

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Transactional collections

In this section, we take a step away from transactional references, and study more powerful transactional constructs, namely, transactional collections. While transactional references can only hold a single value at once, transactional collections can manipulate multiple values. In principle, the atomic statements and transactional references are sufficient to express any kind of transaction over shared data. However, ScalaSTM's transactional collections are deeply integrated with the STM. They can be used to express shared data operations more conveniently and execute the transactions more efficiently.

Transaction-local variables

We have already seen that some transactions need to create a local mutable state that exists ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required