FileDocCategorySizeDatePackage
DistributedIterator.javaAPI DocExample2525Tue Apr 04 20:10:14 BST 2000com.imaginary.util

DistributedIterator

public interface DistributedIterator implements Remote
Wraps an Iterator so that it can act as a distributed iterator. A distributed iterator is an iterator where the collection is stored on a server and elements are transmitted across the network one element at a time on demand. This contrasts with serialization of the collection, where the entire collection is transmitted across the network at once.

If you have a collection whose elements you want to make available across the network using the distributed iterator paradigm, you retrieve an iterator for the collection and wrap it with a DistributedIterator implementation. You then pass the distributed iterator to a ClientIterator and pass that across the network. Consider the following RMI method that returns a distributed iterator for its remote method cats():

private ArrayList cats;

public Iterator cats() throws RemoteException {
DistributedIterator dist = new DistributedIteratorImpl(cats.iterator());
ClientIterator it = new ClientIterator(dist);

return it;
}
The result of this method is that an empty iterator is sent across the network to the client. That empty iterator knows how to retrieve each cat from the cats ArrayList from the server on demand as the client application calls for them. If the client only asks for the first cat, only the first cat is ever sent across the network. If the collection of cats contains 1 million cats, the client does not need to wait on that entire collection to be transmitted across the network before it can access the first cat.
Last modified $Date: 1999/11/06 18:38:04 $
version
$Revision: 1.1.1.1 $
author
George Reese (borg@imaginary.com)

Fields Summary
Constructors Summary
Methods Summary
public booleanhasNext()

return
true if more elements are available in the iterator

public java.lang.Objectnext()

return
the next element in the iterator

public voidremove()
This operation is unsupported in this implementation.

throws
java.lang.UnsupportedOperationException always thrown