CHAPTER 2

image

Synchronization

Developing multithreaded applications is much easier when threads don’t interact, typically via shared variables. When interaction occurs, various problems can arise that make an application thread-unsafe (incorrect in a multithreaded context). In this chapter, you’ll learn about these problems and also learn how to overcome them through the correct use of Java’s synchronization-oriented language features.

The Problems with Threads

Java’s support for threads facilitates the development of responsive and scalable applications. However, this support comes at the price of increased complexity. Without care, your code can ...

Get Java Threads and the Concurrency Utilities 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.