Mixing Actors and STM
Actors nicely allow us to isolate mutable state. They work great if a problem can be divided into concurrent tasks that can run independently and communicate with each other asynchronously using messages. Actors, however, don’t provide a way to manage consensus across tasks. We may want the actions of two or more actors to all succeed or fail collectively; that is, either all of them succeed or all of them fail. Actors alone can’t do that for us, but we can achieve that by bringing STM into the mix. In this section, I assume you’ve read Chapter 6, Introduction to Software Transactional Memory and the discussions on actors and typed actors in this chapter.
The AccountService class that helped us transfer between two ...
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.
Read now
Unlock full access