JavaSpaces principles, patterns and practice - Eric Freeman - Librairie Eyrolles
Tous nos rayons

Déjà client ? Identifiez-vous

Mot de passe oublié ?

Nouveau client ?

CRÉER VOTRE COMPTE
JavaSpaces principles, patterns and practice
Ajouter à une liste

Librairie Eyrolles - Paris 5e
Indisponible

JavaSpaces principles, patterns and practice

JavaSpaces principles, patterns and practice

Eric Freeman - Collection The Jini technology series

343 pages, parution le 15/08/1999

Résumé

"Ever since I first saw David Gelernter's Linda programming language almost twenty years ago, I felt that the basic ideas of Linda could be used to make an important advance in the ease of distributed and parallel programming. As part of the fruits of Sun's Jini project, we now have the JavaSpaces technology, a wonderfully simple platform for developing distributed applications that takes advantage of the power of the Java programming language. This important book and its many examples will help you learn about distributed and parallel programming. I highly recommend it to students, programmers, and the technically curious."
Bill Joy, Chief Scientist and co-founder, Sun Microsystems, Inc.

JavaSpaces technology, a powerful Jini service from Sun Microsystems, facilitates building distributed applications for the Internet and Intranets. The JavaSpaces model involves persistent object exchange "areas" in which remote processes can coordinate their actions and exchange data. It provides a necessary ubiquitous, cross-platform framework for distributed computing, emerging as a key technology in this expanding field.


This book introduces the JavaSpaces architecture, provides a definitive and comprehensive description of the model, and demonstrates how to use it to develop distributed computing applications. The book presents an overview of the JavaSpaces design and walks you through the basics, demonstrating key features through examples. Every aspect of JavaSpaces programming is examined in depth: entries, distributed data structures, synchronization, communication, application patterns, leases, distributed events, and transactions.


You will find information on such vital topics as:

  • Distributed data structures
  • Synchronization techniques
  • Loosely coupled communication
  • Message passing
  • Channel data structures for communication
  • Application patterns such as replicated worker, command pattern, and marketplace
  • Leases and automated lease renewal
  • Using distributed events with spaces
  • Handling partial failure with distributed transactions
  • The official JavaSpaces specification from Sun Microsystems

JavaSpaces Principles, Patterns, and Practice also includes two full-scale applications--one collaborative and the other parallel--that demonstrate how to put the JavaSpaces model to work.


Contents


1 Introduction 1


1.1 Benefits of Distributed Computing 2


1.2 Challenges of Distributed Computing 3


1.3 What Is JavaSpaces Technology? 4


1.3.1 Key Features 6


1.3.2 JavaSpaces Technology in Context 8


1.4 JavaSpaces Technology Overview 9


1.4.1 Entries and Operations 9


1.4.2 Going Further 11


1.5 Putting It All Together 14


1.6 Advantages of JavaSpaces Technologies 16

1.7 Chapter Preview 17


1.8 Exercises 19


2 JavaSpaces Application Basics 21



2.1 Entries 22


2.1.1 The Entry Interface 22


2.1.2 Instantiating an Entry 23


2.1.3 Adding Fields and Methods 23


2.2 Building an Application 25


2.2.1 The SpaceAccessor 26


2.3 Writing Entries into a Space 28


2.3.1 A Closer Look at write 30


2.4 Reading and Taking Entries 31


2.4.1 Associative Lookup 31


2.4.2 The Basics of read and take 32


2.4.3 The Rules of Matching 33


2.4.4 Dealing with null-valued Fields in Entries 35


2.4.5 Primitive Fields 36


2.4.6 A Closer Look at read and take 36


2.5 Going Further with the Example 38


2.5.1 Subclassing an Entry 39


2.5.2 Adding a Few More Methods 40


2.5.3 Trying the Game 42


2.5.4 Post-Game Analysis 44


2.6 Serialization and Its Effects 44


2.6.1 Entry Serialization 45


2.6.2 Matching and Equality 47


2.6.3 The No-arg Constructor 47


2.6.4 The Entry Interface Revisited 48


2.6.5 Improving Entry Serialization Using snapshot 48


2.7 Summary 49



3 Building Blocks 51


3.1 Introduction to Distributed Data Structures 52


3.1.1 Building Distributed Data Structures with Entries 53


3.2 Shared Variables 56


3.2.1 Atomic Modification 57


3.2.2 Additional Operations 58


3.2.3 Creating a Web Counter 59


3.2.4 Stepping Back 62


3.3 Unordered Structures 63


3.3.1 Bags 64


3.3.2 Task Bags and Result Bags 65


3.4 Ordered Structures 66


3.4.1 Distributed Arrays Revisited 67


3.5 Summary 73


3.6 Exercises 74


4 Synchronization 75


4.1 Semaphores 76


4.1.1 Implementing a Semaphore 77


4.1.2 Implementing a License Manager 79


4.1.3 The License Manager Installer 79


4.1.4 The License Manager Client Library 80


4.2 Using Multiple Semaphores 81


4.2.1 The Dining Philosophers 82


4.3 Fairly Sharing a Resource 87


4.3.1 Using a Queue to Take Turns 88


4.3.2 Round-Robin Synchronization 92


4.4 Barrier Synchronization 95


4.5 Advanced Synchronization: The Readers/Writers Problem 97


4.5.1 Implementing a Readers/Writers Solution 98


4.5.2 Implementing a Counter 99


4.5.3 Implementing a Space-based Readers/Writers Application 101


4.6 Summary 105


4.7 Exercises 105


5 Communication 107


5.1 Basic Message Passing 108


5.1.1 Playing Ping-Pong 109


5.2 Characteristics of Space-based Communication 113


5.2.1 Tightly Coupled Communication 113


5.2.2 Loosely Coupled Communication 114


5.2.3 Benefits of Loose Coupling 115


5.3 Beyond Message Passing 116


5.4 A Basic Channel 116


5.4.1 The Channel Message 117


5.4.2 The Channel Tail 118


5.4.3 Creating a Channel 118


5.4.4 Appending a Message to a Channel 119


5.4.5 Implementing a Channel Writer 121


5.4.6 Implementing a Channel Reader 123


5.4.7 Demonstrating the Channel Writer and Reader 126


5.5 Building a Chat Application with Channels 127


5.5.1 The Graphical User Interface 127


5.5.2 Combining Channel Writing and Reading 128


5.6 A Consumer Channel 130


5.6.1 Implementing a Pager Service 131


5.6.2 The Pager Message Entry 133


5.6.3 Tracking the Start and End of a Channel 133


5.6.4 The Index Entry 134


5.6.5 Creating a Consumer Channel 135


5.6.6 Sending Messages to the Channel 136


5.6.7 Reading and Removing Messages from the Channel 138


5.6.8 Demonstrating the Pager 141


5.7 Bounded Channels 141


5.7.1 The Status Entry 142


5.7.2 Channel Creation Revisited 143


5.7.3 Writing to a Bounded Channel 144


5.7.4 Taking from a Bounded Channel 146


5.7.5 Demonstrating the Bounded Channel 148


5.8 Summary 149


5.9 Exercises 149


6 Application Patterns 153


6.1 The Replicated-Worker Pattern 153


6.1.1 Computing the Mandelbrot Set 155


6.1.2 Task and Result Entries 157


6.1.3 The Master 159


6.1.4 The Worker 164


6.2 The Command Pattern 166


6.2.1 Implementing a Compute Server 167


6.2.2 The Generic Worker 167


6.2.3 The Generic Master 169


6.2.4 Creating Specialized Tasks and Results 170


6.2.5 Creating a Specialized Master 173


6.2.6 Running the Compute Server 175


6.3 The Marketplace Pattern 176


6.3.1 An Automobile Marketplace 176


6.3.2 Interaction in the Marketplace 177


6.3.3 The Bid Entry 180


6.3.4 The Application Framework 181


6.3.5 The Buyer 182


6.3.6 The Seller 186


6.3.7 Running the Marketplace 191


6.4 Other Patterns 192


6.4.1 Specialist Patterns 192


6.4.2 Collaborative Patterns 193


6.5 Summary 194


6.6 Exercises 194


7 Leases 197


7.1 Leases on Entries 197


7.2 The Lease Object 199


7.2.1 Lease Expiration 200


7.2.2 Renewing a Lease 200


7.2.3 Cancelling a Lease 201


7.3 Lease Maps 202


7.3.1 Creating a Lease Map 202


7.3.2 Adding and Removing Leases 203


7.3.3 Renewing Leases 204


7.3.4 Cancelling Leases 205


7.4 Automated Lease Renewal 206


7.4.1 The LeaseManager Interface 206


7.4.2 Implementing the Constructors 207


7.4.3 Adding Leases 208


7.4.4 Cancelling a Lease 209


7.4.5 Renewing Leases 210


7.4.6 Checking Leases 211


7.4.7 Processing Renewal Failures 213


7.4.8 Putting It All Together 214


7.5 Summary 215


7.6 Exercises 215


8 Distributed Events 217


8.1 Events in the Distributed Environment 217


8.2 Hello World Using notify 220


8.3 The Notification API 222


8.3.1 The JavaSpace notify Method 223


8.3.2 The EventRegistration Class 224


8.3.3 The RemoteEventListener Interface 225


8.3.4 The RemoteEvent Object 225


8.4 Putting the Pieces Together 226


8.4.1 The Channel Relay Application 227


8.4.2 The Channel Reader Thread 229


8.4.3 The Relayer Listener 229


8.4.4 The Notify Handler Thread 231


8.5 Summary 234


8.6 Exercises 234


9 Transactions 237


9.1 The Distributed Transaction Model 238


9.2 Creating a Transaction 239


9.3 Web Counter Revisited 240


9.4 The Spaceis Transactional Properties 243


9.5 Operational Semantics Under Transactions 244


9.5.1 Writing Entries Under a Transaction 244


9.5.2 Reading Entries Under a Transaction 245


9.5.3 read versus readIfExists 245


9.5.4 Taking Entries Under a Transaction 245


9.5.5 Notifications Under Transactions 246


9.6 Summary 246


9.7 Exercises 246


10 A Collaborative Application 247


10.1 The Messenger 247


10.2 Implementing a Messenger User 249


10.3 The Account 249


10.3.1 The Account Object 250


10.4 User Sessions 254


10.4.1 The Session Object 255


10.5 Friends List 257


10.5.1 The FriendsList Object 258


10.5.2 The FriendsListMonitor Object 261


10.6 Communication Channel 263


10.6.1 Message Entries and Indices 263


10.6.2 The Channel Object 265


10.6.3 Retrieving Messages from the Channel 267


10.7 The Messenger Applet 270


10.7.1 Logging in via the Login Object 271


10.7.2 The loginCallback Method 273


10.7.3 Adding to the Friends List 274


10.7.4 Chatting with Friends 275


10.7.5 Sending Messages 277


10.7.6 Listening for Messages 278


10.8 Summary 279


10.9 Exercises 279


11 A Parallel Application 281


11.1 The Compute Server 281


11.1.1 The Command Interface Revisited 281


11.1.2 The Task Entry 282


11.1.3 The Generic Worker 283


11.1.4 A Generic Master 285


11.2 The Crypt Application 287


11.2.1 Background 287


11.2.2 The Generic Worker and Crypt Task 288


11.2.3 The Crypt Master 291


11.2.4 Generating Tasks 294


11.2.5 Improving Space Usage with Watermarking 296


11.2.6 Collecting Results 297


11.2.7 A Little Poison 299


11.2.8 Exploring Crypt 301


11.3 Summary 301


11.4 Exercises 302


12 Further Exploration 303


12.1 Online Resources 303


12.2 Related Java and Jini Technologies 304


12.3 Background Reading 304


12.3.1 Distributed Systems 304


12.3.2 Transactions 305


12.4 Historical Resources 305


Appendix A:
The Jini(TM) Entry Specification 307


A.1 Entries and Templates 307


A.1.1 Operations 307


A.1.2 Entry 308


A.1.3 Serializing Entry Objects 308


A.1.4 UnusableEntryException 309


A.1.5 Templates and Matching 311


A.1.6 Serialized Form 311


A.1.7 Comments 311


Appendix B:
The Jini(TM) Entry Utilities Specification 313


B.1 Entry Utilities 313


B.1.1 AbstractEntry 313


B.1.2 Serialized Form 314


B.1.3 Comments 314


Appendix C:
The JavaSpaces(TM) Specification 315


C.1 Introduction 315


C.1.1 The JavaSpaces Application Model and Terms 315


C.1.2 Benefits 318


C.1.3 JavaSpaces Technology and Databases 319


C.1.4 JavaSpaces System Design and Linda Systems 320


C.1.5 Goals and Requirements 322


C.1.6 Dependencies 322


C.1.7 Comments 323


C.2 Operations 323


C.2.1 Entries 323


C.2.2 net.jini.space.JavaSpace 323


C.2.3 write 326


C.2.4 readIfExists and read 326


C.2.5 takeIfExists and take 327


C.2.6 snapshot 327


C.2.7 notify 328


C.2.8 Operation Ordering 329


C.2.9 Serialized Form 330


C.3 Transactions 330


C.3.1 Operations Under Transactions 330


C.3.2 Transactions and ACID Properties 331


C.4 Further Reading 332


C.4.1 Linda Systems 332


C.4.2 The Java Platform 333


C.4.3 Distributed Computing 333


Index 334


L'auteur - Eric Freeman

Eric Freeman et Elisabeth Freeman mettent leur talent à votre service. Ils ont passé plus de quatre années à créer des logiciels et à développer des services Internet pour Walt Disney.

Caractéristiques techniques

  PAPIER
Éditeur(s) Addison Wesley
Auteur(s) Eric Freeman
Collection The Jini technology series
Parution 15/08/1999
Nb. de pages 343
Format 18,5 x 23,3
Poids 650g
EAN13 9780201309553

Avantages Eyrolles.com

Livraison à partir de 0,01 en France métropolitaine
Paiement en ligne SÉCURISÉ
Livraison dans le monde
Retour sous 15 jours
+ d'un million et demi de livres disponibles
satisfait ou remboursé
Satisfait ou remboursé
Paiement sécurisé
modes de paiement
Paiement à l'expédition
partout dans le monde
Livraison partout dans le monde
Service clients sav@commande.eyrolles.com
librairie française
Librairie française depuis 1925
Recevez nos newsletters
Vous serez régulièrement informé(e) de toutes nos actualités.
Inscription