Lot of us know that writing multi-threaded/concurrent applications in Java is not just about creating Thread objects and passing in Runnable implementations. Few of them mastered the art of concurrent programming and explored alternatives not only provided by Java but other languages like Scala, Groovy, Clojure. But quite a few of us have tried to venture into learning the nuisance of multi-threading, concurrency and never got close to even attempting to learn. And then we complain that Java doesn’t provide the constructs required for writing concurrent applications. The fact is that we never were aware of any good material which would help us to prepare and learn to build thread safe, concurrent applications.
I think your search should end at “Java Concurrency in Practice” by Brian Goetz and others. I should say I was fortunate to have got a copy of it and been able to read most of the chapters (I would dare not say all chapters, because few chapters in the advanced section were a bit difficult to comprehend). In this review I will throw some light on what the book covers, its salient features and who should read this book.
- basic multi-threaded concepts like thread safety, creating objects which are thread safe, synchronized blocks. There are lot of concepts explained here which are referred in future chapters.
- the concurrency framework introduced in java.util.concurrent package as part of the Java 5 release.
- different concepts like deadlock- detecting and diagnosing, performance and scalability concerns when it comes to mutli-threaded applications.
- how to test concurrent applications, use tools like FindBugs and importance of code reviews in finding subtle issues.
- some advanced topics like Atomic constructs in java.util.concurrent package, non-blocking synchronization.
- the chapters have been organized such that it takes the readers from basic concepts and builds on that to advanced concepts.
- each concept has been explained with code, though the code examples are not complete, they are just enough to understand what the authors want to convey.
- the incomplete examples give some scope for readers to implement full fledged samples.
- important concepts have been summarized where ever required
Who should read this book
- If you are a beginner in Java, unaware of use of Threads, Runnable- then this book is not for you.
- If you have programmed in Java, know how the use of Thread and Runnable and managing different threads is a pain- then you should pick this book to go beyond Thread and Runnable
- If you are already familiar with java.util.concurrent package and all the things it offers, you should use this book to understand the advanced concepts like testing, understanding the performance and scalability aspects.
The book is heavy on concepts and requires lot of concentration from the readers part. Its very important to read the initial few chapters carefully and understand the basic concepts and lot of jargons which are used extensively through out the book.
Java Concurrency in Practice is intended for those who are aware of Thread concepts in Java and want to improve their concepts related to developing Multi-Threaded/Concurrent applications in Java and learn about the framework provided in Java for the same.
Some of the concepts explained in the book have been captured as blog posts:
- Using ExecuterService framework to develop applications which support concurrent execution of tasks. More details can be read in the post here.
- Using BlockingQueue to solve the Producer and consumer problem. More details can be found here.