Recap

In this chapter, we learned the following:

  • Concurrency choice is orthogonal to language choice; we can program concurrency with STM from any of the JVM languages.

  • There are a few rough edges with integration we’ll run into, but the workarounds are fairly easy.

  • We have to ensure that values are immutable and transactions are idempotent.

For applications with frequent reads and reasonable write collisions, we can make use of STM from any JVM language. But when huge write collisions creep in, STM may not be suitable. In that case, to avoid synchronization and shared mutability nightmares, we can benefit from the actor-based model we discuss in the next chapter.

Get Programming Concurrency on the JVM 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.