Concurrent Programming in Java: Design Principles and Pattern / Edition 2

Paperback (Print)
Used and New from Other Sellers
Used and New from Other Sellers
from $4.54
Usually ships in 1-2 business days
(Save 93%)
Other sellers (Paperback)
  • All (20) from $4.54   
  • New (9) from $46.87   
  • Used (11) from $4.54   

Overview

In this second edition, you will find thoroughly updated coverage of the Javao 2 platform and new or expanded coverage of:

  • Memory model
  • Cancellation
  • Portable parallel programming
  • Utility classes for concurrency control

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.

0201310090B04062001

Read More Show Less

Editorial Reviews

Booknews
An outgrowth of a set of Web pages Lea started in 1995 to document and clarify his own early efforts with the concurrency features of the computer language, now updated to incorporate the Java 2 platform. He shows intermediate to advanced programmers how to use the platforms's threading model more precisely by explaining the patterns and tradeoffs associated with concurrent programming. Annotation c. Book News, Inc., Portland, OR (booknews.com)
Read More Show Less

Product Details

  • ISBN-13: 9780201310092
  • Publisher: Addison-Wesley
  • Publication date: 10/25/1999
  • Series: Java Series
  • Edition description: REV
  • Edition number: 2
  • Pages: 432
  • Product dimensions: 7.40 (w) x 9.20 (h) x 0.60 (d)

Meet the Author

Doug Lea is one of the foremost experts on object-oriented technology and software reuse. He has been doing collaborative research with Sun Labs for more than five years. Lea is Professor of Computer Science at SUNY Oswego, Co-director of the Software Engineering Lab at the New York Center for Advanced Technology in Computer Applications, and Adjunct Professor of Electrical and Computer Engineering at Syracuse University. In addition, he co-authored the book, Object-Oriented System Development (Addison-Wesley, 1993). He received his B.A., M.A., and Ph.D. from the University of New Hampshire.

Read More Show Less

Read an Excerpt


Chapter 1: Concurrent Object-Oriented Programming

This book discusses some ways of thinking about, designing, and implementing concurrent programs in the Java programming language. Most presentations in this book assume that you are an experienced developer familiar with objectoriented (00) programming, but have little exposure to concurrency. Readers with the opposite background - experience with concurrency in other languages - may also find this book useful.

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:

http://java.sun.com/Series or
http://gee.cs.oswego.edu/dl/cpj

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

Read More Show Less

Table of Contents

1. Concurrent Object-Oriented Programming.

Using Concurrency Constructs.

A Particle Applet.

Thread Mechanics.

Further Readings.

Objects and Concurrency.

Concurrency.

Concurrent Execution Constructs.

Concurrency and OO Programming.

Object Models and Mappings.

Further Readings.

Design Forces.

Safety.

Liveness.

Performance.

Reusability.

Further Readings.

Before/After Patterns.

Layering.

Adapters.

Subclassing.

Method Adapters.

Further Readings.

2. Exclusion.

Immutability.

Applications.

Construction.

Synchronization.

Mechanics.

Fully Synchronized Objects.

Traversal.

Statics and Singletons.

Deadlock.

Resource Ordering.

The Java Memory Model.

Further Readings.

Confinement.

Confinement Across Methods.

Confinement Within Threads.

Confinement Within Objects.

Confinement Within Groups.

Further Readings.

Structuring and Refactoring Classes.

Reducing Synchronization.

Splitting Synchronization.

Read-Only Adapters.

Copy-on-Write.

Open Containers.

Further Readings.

Using Lock Utilities.

Mutexes.

Read-Write Locks.

Further Readings.

3. State Dependence.

Dealing with Failure.

Exceptions.

Cancellation.

Further Readings.

Guarded Methods.

Guarded Suspension.

Monitor Mechanics.

Guarded Waits.

Notifications.

Timed Waits.

Busy Waits.

Structuring and Refactoring Classes.

Tracking State.

Conflict Sets.

Subclassing.

Confinement and Nested Monitors.

Further Readings.

Using Concurrency Control Utilities.

Semaphores.

Latches.

Exchangers.

Condition Variables.

Further Readings.

Joint Actions.

General Solutions.

Decoupling Observers.

Further Readings.

Transactions.

Transaction Protocols.

Transaction Participants.

Creating Transactions.

Vetoable Changes.

Further Readings.

Implementing Utilities.

Acquire-Release Protocols.

Delegated Actions.

Specific Notifications.

Further Readings.

4. Creating Threads.

Oneway Messages.

Message Formats.

Open Calls.

Thread-Per-Message.

Worker Threads.

Polling and Event-Driven IO.

Further Readings.

Composing Oneway Messages.

Composition.

Assembly Line.

Further Readings.

Services in Threads.

Completion Callbacks.

Joining Threads.

Futures.

Scheduling Services.

Further Readings.

Parallel Decomposition.

Fork/Join.

Computation Trees.

Barriers.

Further Readings.

Active Objects.

CSP.

Further Readings.

Index. 0201310090T04062001

Read More Show Less

Customer Reviews

Be the first to write a review
( 0 )
Rating Distribution

5 Star

(0)

4 Star

(0)

3 Star

(0)

2 Star

(0)

1 Star

(0)

Your Rating:

Your Name: Create a Pen Name or

Barnes & Noble.com Review Rules

Our reader reviews allow you to share your comments on titles you liked, or didn't, with others. By submitting an online review, you are representing to Barnes & Noble.com that all information contained in your review is original and accurate in all respects, and that the submission of such content by you and the posting of such content by Barnes & Noble.com does not and will not violate the rights of any third party. Please follow the rules below to help ensure that your review can be posted.

Reviews by Our Customers Under the Age of 13

We highly value and respect everyone's opinion concerning the titles we offer. However, we cannot allow persons under the age of 13 to have accounts at BN.com or to post customer reviews. Please see our Terms of Use for more details.

What to exclude from your review:

Please do not write about reviews, commentary, or information posted on the product page. If you see any errors in the information on the product page, please send us an email.

Reviews should not contain any of the following:

  • - HTML tags, profanity, obscenities, vulgarities, or comments that defame anyone
  • - Time-sensitive information such as tour dates, signings, lectures, etc.
  • - Single-word reviews. Other people will read your review to discover why you liked or didn't like the title. Be descriptive.
  • - Comments focusing on the author or that may ruin the ending for others
  • - Phone numbers, addresses, URLs
  • - Pricing and availability information or alternative ordering information
  • - Advertisements or commercial solicitation

Reminder:

  • - By submitting a review, you grant to Barnes & Noble.com and its sublicensees the royalty-free, perpetual, irrevocable right and license to use the review in accordance with the Barnes & Noble.com Terms of Use.
  • - Barnes & Noble.com reserves the right not to post any review -- particularly those that do not follow the terms and conditions of these Rules. Barnes & Noble.com also reserves the right to remove any review at any time without notice.
  • - See Terms of Use for other conditions and disclaimers.
Search for Products You'd Like to Recommend

Recommend other products that relate to your review. Just search for them below and share!

Create a Pen Name

Your Pen Name is your unique identity on BN.com. It will appear on the reviews you write and other website activities. Your Pen Name cannot be edited, changed or deleted once submitted.

 
Your Pen Name can be any combination of alphanumeric characters (plus - and _), and must be at least two characters long.

Continue Anonymously
Sort by: Showing all of 2 Customer Reviews
  • Anonymous

    Posted January 27, 2000

    Most Accurate and Detailed Book on Java Threads

    <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  No   Report this review
  • Anonymous

    Posted January 7, 2009

    No text was provided for this review.

Sort by: Showing all of 2 Customer Reviews

If you find inappropriate content, please report it to Barnes & Noble
Why is this product inappropriate?
Comments (optional)