com.healthmarketscience.rmiio
Class RemoteIteratorServer<DataType>

java.lang.Object
  extended by com.healthmarketscience.rmiio.RemoteIteratorServer<DataType>
All Implemented Interfaces:
Closeable
Direct Known Subclasses:
EncodingRemoteIteratorServer

public class RemoteIteratorServer<DataType>
extends Object
implements Closeable

Base class for implementing the server side of a RemoteIterator. This object manages RemoteInputStreamServer which connects the client and the server. Implementations of this class must provide an InputStream which is the source of the data going over the wire. Note, users of this class should ensure that the close() method is called one way or another, or shutdown of the process may be delayed.

Author:
James Ahlborn

Field Summary
protected  InputStream _localIStream
          InputStream which is used by the RemoteInputStreamServer to read the objects.
 
Constructor Summary
RemoteIteratorServer(InputStream localIStream)
           
RemoteIteratorServer(InputStream localIStream, boolean useCompression)
           
RemoteIteratorServer(InputStream localIStream, boolean useCompression, RemoteStreamMonitor<RemoteInputStreamServer> monitor)
           
RemoteIteratorServer(InputStream localIStream, boolean useCompression, RemoteStreamMonitor<RemoteInputStreamServer> monitor, int chunkSize)
           
 
Method Summary
 void abort()
          Aborts the current transfer without closing this RemoteIteratorServer.
 void close()
          Forces this iterator server to close (if not already closed), will break any outstanding client interactions.
protected  void closeImpl(boolean readSuccess)
          Cleans up any local resources after the underlying stream server is closed.
 boolean isClosed()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_localIStream

protected final InputStream _localIStream
InputStream which is used by the RemoteInputStreamServer to read the objects.

Constructor Detail

RemoteIteratorServer

public RemoteIteratorServer(InputStream localIStream)
                     throws IOException
Throws:
IOException

RemoteIteratorServer

public RemoteIteratorServer(InputStream localIStream,
                            boolean useCompression)
                     throws IOException
Throws:
IOException

RemoteIteratorServer

public RemoteIteratorServer(InputStream localIStream,
                            boolean useCompression,
                            RemoteStreamMonitor<RemoteInputStreamServer> monitor)
                     throws IOException
Throws:
IOException

RemoteIteratorServer

public RemoteIteratorServer(InputStream localIStream,
                            boolean useCompression,
                            RemoteStreamMonitor<RemoteInputStreamServer> monitor,
                            int chunkSize)
                     throws IOException
Throws:
IOException
Method Detail

isClosed

public final boolean isClosed()
Returns:
true iff this iterator server has been closed (one way or another), false otherwise.

close

public final void close()
Forces this iterator server to close (if not already closed), will break any outstanding client interactions. Should be called one way or another on the server object (may be left to the underlying stream unreferenced method if the server object must live beyond the creation method call).

Specified by:
close in interface Closeable

abort

public void abort()
           throws IOException
Aborts the current transfer without closing this RemoteIteratorServer. This method is thread safe. This will usually shutdown a currently working transfer faster than just closing the RemoteIteratorServer directly (because this will cause the client to get an IOException instead of a RemoteException, which may cause retries, etc.). This RemoteIteratorServer should still be closed as normal.

Throws:
IOException

closeImpl

protected void closeImpl(boolean readSuccess)
                  throws IOException
Cleans up any local resources after the underlying stream server is closed. Since this method is called by the close() method on the underlying remote stream, it will be invoked on a successful remote close.

Parameters:
readSuccess - true iff all data was successfully transferred, false otherwise
Throws:
IOException


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