The JavaSpace Interface

The JavaSpace specification also defines a JavaSpace class that provides an interface to a remote JavaSpace. The JavaSpace interface provides read(), write(), take(), and notify() methods, which allow clients to perform the basic operations on the JavaSpace. Each of these methods takes an EntryRep (used as either an entry to put into the space, or a template to use for matching an entry already in the space), an optional Transaction within which the operation should be carried out, and an optional Identity, which can be used to verify the client’s access to the JavaSpace entries against an access-control list. The Identity can be used to verify the caller’s right to execute the given operation on the JavaSpace, perhaps by checking an access-control list. The current specification is not clear about whether this Identity argument will use the Identity class from the Java Security API, but it seems likely that it would.

The rest of this section describes the methods available on the JavaSpace interface for executing operations and transactions against the space.


void write(EntryRep r, Transaction t, Identity i)  
    throws RemoteException, TransactionException, SecurityException

A write() call adds an EntryRep to the JavaSpace. Each field in the enclosed Entry is serialized independently, and the serialized bytes making up the entire Entry are sent to the JavaSpace for storage and later lookup. If a Transaction is included in the write() call, then the new ...

Get Java Distributed Computing now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.