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

Get Learning Concurrent Programming in 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.