Preface

When Sun Microsystems released the first alpha version of Java™ in the winter of 1995, developers all over the world took notice. There were many features of Java that attracted these developers, not the least of which were the set of buzzwords Sun used to promote Java: Java was, among other things, robust, safe, architecture-neutral, portable, object oriented, simple, and multithreaded. For many developers, these last two buzzwords seemed contradictory: how could a language that is multithreaded be simple?

It turns out that Java’s threading system is simple, at least relative to other threading systems. This simplicity makes Java’s threading system easy to learn, so that even developers who are unfamiliar with threads can pick up the basics of thread programming with relative ease. But this simplicity comes with trade-offs: some of the advanced features that are found in other threading systems are not present in Java. However, these features can be built by the Java developer from the simpler constructs Java provides. And that’s the underlying theme of this book: how to use the threading tools in Java to perform the basic tasks of threaded programming, and how to extend them to perform more advanced tasks for more complex programs.

Who Should Read This Book?

This book is intended for programmers of all levels who need to learn to use threads within Java programs. The first few chapters of the book deal with the issues of threaded programming in Java, starting at a basic level: no assumption is made that the developer has had any experience in threaded programming. As the chapters progress, the material becomes more advanced, in terms of both the information presented and the experience of the developer that the material assumes. For developers who are new to threaded programming, this sequence should provide a natural progression of the topic.

This progression mimics the development of Java itself as well as the development of books about Java. Early Java programs tended to be simple, though effective: an animated image of Duke dancing on a web page was a powerful advertisement of Java’s potential, but it barely scratched the surface of that potential. Similarly, early books about Java tended to be complete overviews of Java with only a chapter or two dedicated to Java’s threading system.

This book belongs to the second wave of Java books: because it covers only a single topic, it has the luxury of explaining in deeper detail how Java’s threads can be used. It’s ideally suited to developers targeting the second wave of Java programs—more complex programs that fully exploit the power of Java’s threading system.

Though the material presented in this book does not assume any prior knowledge of threads, it does assume that the reader has a knowledge of other areas of the Java API and can write simple Java programs.

Get Java Threads, Second Edition 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.