Chapter 2. JavaSpaces Application Basics

"Think simple" as my old master used to say—meaning reduce the whole of its parts into the simplest terms, getting back to first principles.

—Frank Lloyd Wright

In this chapter we are going to cover the basics of the JavaSpaces API—examining its core interfaces and classes for dealing with entries and spaces. We will also look at how it all works and explain some of the mechanics of creating space-based applications. Our aim is to give you the foundation you need to understand and experiment with the example programs in the next several chapters and to start building your own space-based applications.

Our discussion in this chapter will center around the net.jini.javaspace and net.jini.core.entry packages, which are at the heart of JavaSpaces programming. Both of these packages are part of a larger set of Jini (pronounced genie) packages; Jini is an ambitious distributed computing environment upon which JavaSpaces is built. You can find references to information about Jini in Chapter 12.

We will also spend a fair amount of time in this book covering the net.jini.core.lease, net.jini.core.event, and net.jini.core.transactions packages. The lease package allows us to control the lifetime of entries that we place into a space. The event package naturally extends Java's event model to the distributed environment. Using this distributed event model in combination with spaces, we can write programs that react to the arrival of entries in a space. The transaction package gives us a way to deal with partial failure by providing transactional security for operations across multiple operations and spaces. We will use transactions to write space-based programs that behave correctly even in the face of failing machines and networks.

Together, these packages provide a powerful set of tools for creating advanced distributed applications. However, to begin creating space-based applications we don't have to understand all of them; in fact, we will cover a lot of ground with just the net.jini.javaspace and net.jini.core.entry packages. You'll need to be aware of the other packages and their role in space-based programming in this chapter, but you won't have to understand their details until later in the book; you'll find these other APIs first covered in Chapter 7 (Leases), Chapter 8 (Distributed Events), and Chapter 9 (Transactions).

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset