Recap

The modern concurrency API java.util.concurrent has improved a number of things over the older API. It allows us to do the following:

  • Manage a pool of threads

  • Easily schedule tasks for concurrent execution

  • Exchange data between concurrently running threads in a thread-safe manner

  • Gain fine-grained synchronization

  • Benefit from better concurrent performance using concurrent data structures

Although the newer API helps in a number of ways, it still requires us to be vigilant to avoid race conditions and shared mutable data.

We’ll discuss some of the ways to deal with shared mutability in the next chapter.

Footnotes

[10]

Later we’ll see how the actor-based model fits really well to solve this problem.

[11]

See how easy it is to fall into ...

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.