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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.