How can I read all matching Entry objects from a JavaSpace?

Tim Rohaly

When you read() or take() an entry from a JavaSpace, the entry that you get is a random one which matches your template. If there are multiple objects matching your template, you only get one. In order to iterate over all matching entries, you need to perform a take() in a loop, removing each matching entry one at a time. If you are just trying to read (not remove) these objects, this take() operation should be done as part of a transaction, which can then be aborted.