Chapter 6. Actors and Concurrency

Java introduced the synchronized keyword, which provided language-level concurrency management. Coming from C++, built-in language-level concurrency had the benefits of a unified model, so each project or module had the same concurrency mechanism and there was no need to roll your own. Java's synchronization semantics are very simple. You lock an object for exclusive use on a given thread, and the JVM assures you that the object will not be locked by another thread. Furthermore, because the JVM assures you that you can enter the lock multiple times on the same thread and at the bytecode level, you know that the lock will be released no matter how your application unwinds the stack.[24]

In practical use, Java's ...

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