- Shopping Bag ( 0 items )
In this second edition, you will find thoroughly updated coverage of the Javao 2 platform and new or expanded coverage of:
The Java platform provides a broad and powerful set of APIs, tools, and technologies. One of its most powerful capabilities is the built-in support for threads. This makes concurrent programming an attractive yet challenging option for programmers using the Java programming language.
This book shows readers how to use the Java platform's threading model more precisely by helping them to understand the patterns and tradeoffs associated with concurrent programming.
You will learn how to initiate, control, and coordinate concurrent activities using the class java.lang.Thread, the keywords synchronized and volatile, and the methods wait, notify, and notifyAll. In addition, you will find detailed coverage of all aspects of concurrent programming, including such topics as confinement and synchronization, deadlocks and conflicts, state-dependent action control, asynchronous message passing and control flow, coordinated interaction, and structuring web-based and computational services.
The book targets intermediate to advanced programmers interested in mastering the complexities of concurrent programming. Taking a design pattern approach, the book offers standard design techniques for creating and implementing components that solve common concurrent programming challenges. The numerous code examples throughout help clarify the subtleties of the concurrent programming concepts discussed.
The book is organized into four coarse-grained chapters. (Perhaps parts would be a better term.) This first chapter begins with a brief tour of some frequently used constructs and then backs up to establish a conceptual basis for concurrent object-oriented programming: how concurrency and objects fit together, how the resulting design forces impact construction of classes and components, and how some common design patterns can be used to structure solutions.
The three subsequent chapters are centered around use (and evasion) of the three kinds of concurrency constructs found in the Java programming language:
Exclusion. Maintaining consistent states of objects by preventing unwanted interference among concurrent activities, often using synchronized methods.
State dependence. Triggering, preventing, postponing, or recovering from actions depending on whether objects are in states in which these actions could or did succeed, sometimes using monitor methods Object.wait, Object.notify, and Object. notifyAll.
Creating threads. Establishing and managing concurrency, using Thread objects.
Each chapter contains a sequence of major sections, each on an independent topic. They present high-level design principles and strategies, technical details surrounding constructs, utilities that encapsulate common usages, and associated design patterns that address particular concurrency problems. Most sections conclude with an annotated set of further readings providing more information on selected topics. The online supplement to this book contains links to additional online resources, as well as updates, errata, and code examples. It is accessible via links from:
If you are already familiar with the basics, you can read this book in the presented order to explore each topic in more depth. But most readers will want to read this book in various different orders. Because most concurrency concepts and techniques interact with most others, it is not always possible to understand each section or chapter in complete isolation from all the others. However, you can still take a breadth-first approach, briefly scanning each chapter (including this one) before proceeding with more detailed coverage of interest. Many presentations later in the book can be approached after selectively reading through earlier material indicated by extensive cross-references.
You can practice this now by skimming through the following preliminaries.
Terminology. This book uses standard 00 terminological conventions: programs define methods (implementing operations) and fields (representing attributes) that hold for all instances (objects) of specified classes.
Interactions in 00 programs normally revolve around the responsibilities placed upon a client object needing an action to be performed, and a server object containing the code to perform the action. The terms client and server are used here in their generic senses, not in the specialized sense of distributed client/server architectures. A client is just any object that sends a request to another object, and a server is just any object receiving such a request. Most objects play the roles of both clients and servers. In the usual case where it doesn't matter whether an object under discussion acts as a client or server or both, it is usually called a host; others that it may in turn interact with are often called helpers or peers. Also, when discussing invocations of the form obj.msg(arg), the recipient (that is, the object bound to variable obj) is called the target object.
This book generally avoids dealing with transient facts about particular classes and packages not directly related to concurrency. And it does not cover details about concurrency control in specialized frameworks such as Enterprise JavaBeans and Servlets. But it does sometimes refer to branded software and trademarked products associated with the Java Platform. The copyright page of this book provides more information.
Code listings. Most techniques and patterns in this book are illustrated by variants of an annoyingly small set of toy running examples. This is not an effort to be boring, but to be clear. Concurrency constructs are often subtle enough to get lost in otherwise meaningful examples. Reuse of running examples makes small but critical differences more obvious by highlighting the main design and implementation issues. Also, the presentations include code sketches and fragments of classes that illustrate implementation techniques, but are not intended to be complete or even compilable. These classes are indicated by leading comments in the listings.
Import statements, access qualifiers, and even methods and fields are sometimes omitted from listings when they can be inferred from context or do not impact relevant functionality. The protected qualifier is used as a default for non-public features whenever there is no particular reason to restrict subclass access. This emphasizes opportunities for extensibility in concurrent class design (see §1.3.4 and §3.3.3). Classes by default have no access qualifier. Sample listings are sometimes formatted in nonstandard ways to keep them together on pages or to emphasize the main constructions of interest.
The code for all example classes in this book is available from the online supplement. Most techniques and patterns in this book are illustrated by a single code example showing their most typical forms. The supplement includes additional examples that demonstrate minor variations, as well as some links to other known usages. It also includes some larger examples that are more useful to browse and experiment with online than to read as listings.
The supplement provides links to a package, util.concurrent, that contains production-quality versions of utility classes discussed in this book. This code runs on the Java 2 Platform and has been tested with 1.2.x releases. Occasional discussions, asides, and footnotes briefly mention changes from previous releases, potential future changes known at the time of this writing, and a few implementation quirks to watch out for. Check the online supplement for additional updates.
Diagrams. Standard UML notation is used for interaction and class diagrams (see the Further Readings in § 1.1.3). The accompanying diagrams (courtesy of Martin Fowler) illustrate the only forms used in this book. Other aspects of UML notation, methodology, and terminology are not specifically relied on.
Most other diagrams show timethreads in which free-form gray curves trace threads traversing through collections of objects. Flattened arrowheads represent blocking. Objects are depicted as ovals that sometimes show selected internal features such as locks, fields, and bits of code. Thin (usually labeled) lines between objects represent relations (normally references or potential calls) between them. Here's an otherwise meaningless example showing that thread A has acquired the lock for object X, and is proceeding through some method in object Y that serves as a helper to X. Thread B is meanwhile somehow blocked while entering some method in object X ...
1. Concurrent Object-Oriented Programming.
Using Concurrency Constructs.
A Particle Applet.
Objects and Concurrency.
Concurrent Execution Constructs.
Concurrency and OO Programming.
Object Models and Mappings.
Fully Synchronized Objects.
Statics and Singletons.
The Java Memory Model.
Confinement Across Methods.
Confinement Within Threads.
Confinement Within Objects.
Confinement Within Groups.
Structuring and Refactoring Classes.
Using Lock Utilities.
3. State Dependence.
Dealing with Failure.
Structuring and Refactoring Classes.
Confinement and Nested Monitors.
Using Concurrency Control Utilities.
4. Creating Threads.
Polling and Event-Driven IO.
Composing Oneway Messages.
Services in Threads.
Posted January 27, 2000
<p>As it says on the back cover of the book, it 'targets intermediate to advanced programmers interested in mastering the complexities of concurrent programming.' This statement needs to be taken seriously as a beginner will just be totally lost in this book. This is a complex topic that beginners need help on anyway so this is fine.</p> <p>The book is broken up into four sections. The first is an introduction to common topics. The other three sections talk about different kinds of concurrency mechanisms. The breakdown shows that this is more of a textbook rather than a how-to guide. One way of looking at this book is that it is a set of concurrency design patterns.</p> <p>This is one of the rare books on Java threads where the author understands the topic and is accurate. The most common mistake in the other books is to make assumptions about how Java works based on the way threading works on one platform. Doug definitely does not make this mistake.</p> <p>It took me a long time to read this book because of the depth of the coverage. Almost every paragraph had me think about the implications of the issues Doug raised in my past and future projects. In other words, this was a book that definitely made me think.</p> <p>This is really the definitive book on Java threads. The only thing that stops it from being perfect is that the writing is quite dry. However, if you are not a beginner and working on a serious multithreading project, this book is a must to own.</p>Was this review helpful? Yes NoThank you for your feedback. Report this reviewThank you, this review has been flagged.
Posted January 7, 2009
No text was provided for this review.