O'Reilly logo

Beginning Scala by David Pollak

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required