3.4. Ordered Structures

One of the most commonly asked questions from those seeing the JavaSpace interface for the first time is “Why can't I get a list of all the entries in a space?” It is a good question, as it is often necessary to iterate through a set of entries. The answer is, quite simply, that the interface doesn't need to provide a way of listing entries, because enumeration is easily accomplished using simple programming techniques.

We already got a taste of these techniques earlier in the chapter when we took a brief look at how a distributed array might be implemented. The basic technique is this: We create lists (or more generally, ordered distributed data structures) by including an index or “position” field in entries. Used in ...

Get JavaSpaces™ Principles, Patterns, and Practice now with the O’Reilly learning platform.

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