com.healthmarketscience.rmiio
Interface RemoteIterator<DataType>

All Superinterfaces:
Closeable, CloseableIOIterator<DataType>, IOIterator<DataType>, RemoteClient, Serializable
All Known Implementing Classes:
RemoteIteratorClient, SerialRemoteIteratorClient, SimpleRemoteIterator

public interface RemoteIterator<DataType>
extends CloseableIOIterator<DataType>, Serializable, RemoteClient

Interface for streaming a read-only collection of objects using rmi. Interface mimics the Iterator interface, but allows for IOExceptions and requires the implementation to be Serializable. This interface is useful for situations where a collection is too large to be in memory all at once and instead needs to be streamed to the consumer of the data. For example, data could be read directly from a database and streamed to a remote object using this utility. Generally, one would use the RemoteIteratorClient/Server classes to implement the remote functionality.

Since this interface is built for use in a remote fashion, there is also a close() method to facilitate better resource management. Consumers of the iterator should ensure that the close method is called one way or another (especially if the entire iteration is not consumed!), or resources may not be utilized as efficiently on the server.

Note, implementations of this class are not required to be thread-safe.

Author:
James Ahlborn

Nested Class Summary
 
Nested classes/interfaces inherited from interface com.healthmarketscience.rmiio.CloseableIOIterator
CloseableIOIterator.Adapter<DataType>
 
Field Summary
 
Fields inherited from interface com.healthmarketscience.rmiio.RemoteClient
DEFAULT_RETRY
 
Method Summary
 void close()
          Closes the iterator and releases the resources for the server object.
 
Methods inherited from interface com.healthmarketscience.rmiio.IOIterator
hasNext, next
 
Methods inherited from interface com.healthmarketscience.rmiio.RemoteClient
setRemoteRetry
 

Method Detail

close

void close()
           throws IOException
Closes the iterator and releases the resources for the server object. Note that the remote object may no longer be accessible after this call (depending on the implementation), so clients should not attempt to use this iterator after making this call.

Specified by:
close in interface Closeable
Throws:
IOException


Copyright © 2006–2016 Health Market Science. All rights reserved.