|
OverviewJavaSpaces is a service specification from Sun Microsystems that provides a simple yet powerful infrastructure for building distributed applications. The JavaSpaces specification defines a reliable distributed repository for objects, along with support for distributed transactions, events and leasing. In the JavaSpaces programming model, applications are viewed as a group of processes, cooperating via the flow of objects into and out of spaces. The JavaSpaces API provides software developers with a simple and effective tool for solving coordination problems in distributed systems, especially in domains like parallel processing and distributed persistence. The developer designs the solution as a flow of objects instead of a traditional request/reply message-based scenario.
Inspired by David Gelernter's Tuple-SpacesJavaSpaces is based on the concept of Tuple-Spaces, first described in 1982 in the Linda programming language and system, originally propounded by Dr. David Gelernter at Yale University. The public-domain Linda system is a coordination language that expresses parallel processing algorithms without reference to any specific computer or network architecture. The Linda system also provides inter-process coordination via virtual shared memories, or tuple-spaces, that can be accessed associatively. The tuple-space model is especially useful for concurrent algorithms. Although JavaSpaces technology is strongly influenced by the Linda system, it differs from it in several ways. For example, Java contains richer typing, object orientation, subtype matching, and transactional support spanning multiple spaces, leasing, and events. The JavaSpaces APIThe JavaSpaces API consists of 4 main method types:
In addition, the API enables JavaSpaces' clients (applications) to provide optimization hints to space implementation (the snapshot method). This minimal API set reduces the learning curve, making it easier to adopt JavaSpaces. The API is also natural to Jini developers, since it is built on top of Jini specifications (entries, leases, service, etc.). Jini itself is built on Java and RMI, so there is no need to understand complex distributed Java technologies, like EJB or CORBA. TransactionsJavaSpaces enables full use of transactions, leveraging the default semantics of the Jini Distributed Transactions model. Developers can build transactional, secure distributed applications using JavaSpaces as a coordination mechanism. Since Jini transactions can span more than one Jini Service, and a JavaSpace instance is a Jini Service, a transaction may span more than one space. Block TimeThe JavaSpaces read and take operations can block for a user-defined period of time, in case no matching Entry is found in the space. This allows application instances to wait for data to be written by other instances. Defining a limited block time prevents the application from being blocked indefinitely in case the data does not arrive or the space is in deadlock. LeasesJavaSpaces also makes extensive use of Jini leases, as it mandates leasing of entries in the space (they expire at a certain time unless renewed by a client). This eliminates out-of-date entries and removes the need for manual cleanup administration work. NotificationsJavaSpaces notifications are a great tool for developers who wish to build event-driven, distributed applications. The notifications make use of Jini Remote Events, thus enabling a large number of event-handling design patterns, like the famous Jini MailBox Service. |
(works on Firefox 2 and Internet Explorer 7)