|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.healthmarketscience.rmiio.RemoteIteratorServer<DataType> com.healthmarketscience.rmiio.EncodingRemoteIteratorServer<DataType> com.healthmarketscience.rmiio.SerialRemoteIteratorServer<DataType>
public class SerialRemoteIteratorServer<DataType>
Implementation of RemoteIteratorServer which uses java serialization to send objects to the RemoteIteratorClient. Objects are grabbed from the localIterator as needed and serialized to the local output stream. Note that a RemoteIterator is accepted for the local iterator so that the iterator may throw IOExceptions.
Note, the objects are written to the ObjectOutputStream using the
ObjectOutputStream.writeUnshared(java.lang.Object)
method, and the
ObjectOutputStream.reset()
method is called periodically on
the output stream. These measures are taken because memory can build up in
the ObjectOutputStream over time and a large data set can run the client
and/or server out of memory. In general, the objects being iterated over
most likely do not have shared references, so nothing will be lost by this
choice. However, if shared references are desired, the
serializeObject(java.io.ObjectOutputStream, java.lang.Object)
method can be overriden by a custom subclass to
change this behavior.
In the event that a RemoteIterator is being used to return low-latency, low-bandwidth update data to the client, the noDelay option can be enabled for the underlying stream which will effectively disable buffering of data on the server side. This can be very useful for implementing remote progress monitors, for example.
Note, since it is a common idiom for the local iterator to implement Closeable in order to close local resources, this implementation will automatically close a Closeable local iterator after the underlying server is shutdown.
Field Summary | |
---|---|
static int |
DEFAULT_RESET_NUM_OBJECTS
Default value for the setting indicating how often the ObjectOutputStream should be reset |
Fields inherited from class com.healthmarketscience.rmiio.EncodingRemoteIteratorServer |
---|
_localOStream |
Fields inherited from class com.healthmarketscience.rmiio.RemoteIteratorServer |
---|
_localIStream |
Method Summary | |
---|---|
protected void |
closeImpl(boolean readSuccess)
Cleans up any local resources after the underlying stream server is closed. |
protected void |
closeIterator()
Closes any resources held by this iterator. |
protected void |
serializeObject(ObjectOutputStream ostream,
Object obj)
Writes the given object to the given output stream. |
protected boolean |
writeNextObject()
If there are more objects in the iteration, writes an object to the _localOStream and returns true , otherwise returns
false . |
Methods inherited from class com.healthmarketscience.rmiio.RemoteIteratorServer |
---|
abort, close, isClosed |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int DEFAULT_RESET_NUM_OBJECTS
Constructor Detail |
---|
public SerialRemoteIteratorServer(Iterator<DataType> localIterator) throws IOException
IOException
public SerialRemoteIteratorServer(boolean useCompression, Iterator<DataType> localIterator) throws IOException
IOException
public SerialRemoteIteratorServer(boolean useCompression, boolean noDelay, Iterator<DataType> localIterator) throws IOException
IOException
public SerialRemoteIteratorServer(boolean useCompression, RemoteStreamMonitor<RemoteInputStreamServer> monitor, Iterator<DataType> localIterator) throws IOException
IOException
public SerialRemoteIteratorServer(boolean useCompression, boolean noDelay, RemoteStreamMonitor<RemoteInputStreamServer> monitor, Iterator<DataType> localIterator) throws IOException
IOException
public SerialRemoteIteratorServer(boolean useCompression, boolean noDelay, RemoteStreamMonitor<RemoteInputStreamServer> monitor, int chunkSize, Iterator<DataType> localIterator) throws IOException
IOException
public SerialRemoteIteratorServer(IOIterator<DataType> localIterator) throws IOException
IOException
public SerialRemoteIteratorServer(boolean useCompression, IOIterator<DataType> localIterator) throws IOException
IOException
public SerialRemoteIteratorServer(boolean useCompression, boolean noDelay, IOIterator<DataType> localIterator) throws IOException
IOException
public SerialRemoteIteratorServer(boolean useCompression, RemoteStreamMonitor<RemoteInputStreamServer> monitor, IOIterator<DataType> localIterator) throws IOException
IOException
public SerialRemoteIteratorServer(boolean useCompression, boolean noDelay, RemoteStreamMonitor<RemoteInputStreamServer> monitor, IOIterator<DataType> localIterator) throws IOException
IOException
public SerialRemoteIteratorServer(boolean useCompression, boolean noDelay, RemoteStreamMonitor<RemoteInputStreamServer> monitor, int chunkSize, IOIterator<DataType> localIterator) throws IOException
IOException
public SerialRemoteIteratorServer(boolean useCompression, boolean noDelay, RemoteStreamMonitor<RemoteInputStreamServer> monitor, int chunkSize, IOIterator<DataType> localIterator, int resetNumObjects) throws IOException
IOException
Method Detail |
---|
protected boolean writeNextObject() throws IOException
EncodingRemoteIteratorServer
true
, otherwise returns
false
.
writeNextObject
in class EncodingRemoteIteratorServer<DataType>
IOException
protected void closeIterator() throws IOException
EncodingRemoteIteratorServer
closeIterator
in class EncodingRemoteIteratorServer<DataType>
IOException
protected void closeImpl(boolean readSuccess) throws IOException
RemoteIteratorServer
closeImpl
in class RemoteIteratorServer<DataType>
readSuccess
- true
iff all data was successfully
transferred, false
otherwise
IOException
protected void serializeObject(ObjectOutputStream ostream, Object obj) throws IOException
ObjectOutputStream.writeUnshared(java.lang.Object)
as
well as periodically calls ObjectOutputStream.reset()
on
the output stream. Subclasses may choose to change this behavior by
overriding this method.
ostream
- the output stream to which the object should be writtenobj
- the object to write
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |