com.healthmarketscience.rmiio
Class RemoteOutputStreamWrapper
java.lang.Object
com.healthmarketscience.rmiio.RemoteWrapper<RemoteOutputStream>
com.healthmarketscience.rmiio.RemoteOutputStreamWrapper
- All Implemented Interfaces:
- RemoteClient, RemoteOutputStream, Flushable, InvocationHandler, Remote
public class RemoteOutputStreamWrapper
- extends RemoteWrapper<RemoteOutputStream>
- implements RemoteOutputStream
Wrapper for a RemoteOutputStream stub which handles retry magic under the
hood. The retry policy for a given method call will use the internal
policy for the default methods, but may be overridden on a per-call basis
using the extended methods.
- Author:
- James Ahlborn
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
RemoteOutputStreamWrapper
public RemoteOutputStreamWrapper(RemoteOutputStream stub,
RemoteRetry retry,
org.apache.commons.logging.Log log)
usingGZIPCompression
public boolean usingGZIPCompression()
throws IOException
- Description copied from interface:
RemoteOutputStream
- Returns
true if the stream is using GZIP compression over
the wire.
- Specified by:
usingGZIPCompression in interface RemoteOutputStream
- Returns:
true iff the stream data is compressed,
false otherwise
- Throws:
IOException
usingGZIPCompression
public boolean usingGZIPCompression(RemoteRetry retry)
throws IOException
- Throws:
IOException
close
public void close(boolean writeSuccess)
throws IOException
- Description copied from interface:
RemoteOutputStream
- Closes the output stream and releases the resources for this 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 stream after making this call.
- Specified by:
close in interface RemoteOutputStream
- Parameters:
writeSuccess - true iff all data was sent successfully
from the client, false otherwise
- Throws:
IOException
close
public void close(boolean writeSuccess,
RemoteRetry retry)
throws IOException
- Throws:
IOException
flush
public void flush()
throws IOException
- Description copied from interface:
RemoteOutputStream
- Flushes the output stream and forces as much as possible of any buffered
bytes to be written out. Some of the layers of buffering may not be able
to be flushed, so this method should not be depended upon to do much.
The close() method will do any final flushing necessary (and can be
depended upon).
- Specified by:
flush in interface RemoteOutputStream- Specified by:
flush in interface Flushable
- Throws:
IOException
flush
public void flush(RemoteRetry retry)
throws IOException
- Throws:
IOException
writePacket
public void writePacket(byte[] packet,
int packetId)
throws IOException
- Description copied from interface:
RemoteOutputStream
- Writes the next chunk of data to this stream.
The given packetId parameter (if used correctly) allows this operation to
be idempotent. This parameter must be a monotonically increasing,
positive integer. If the client fails to write a given packet, it may
reattempt to write the same packet by giving the same packetId as from
the failed call. However, only the current packet may be reattempted
(the client cannot attempt to write any other previous packets). When
writing a new packet, the caller does not need to give a sequential id,
just a greater one (hence the term monotonically increasing).
- Specified by:
writePacket in interface RemoteOutputStream
- Parameters:
packet - iff the packetId was the same one from the last read call,
this chunk of data is ignored. Otherwise, writes this new
chunk of data to the stream.packetId - client specified id for this packet
- Throws:
IOException
writePacket
public void writePacket(byte[] packet,
int packetId,
RemoteRetry retry)
throws IOException
- Throws:
IOException
Copyright © 2006-2009 Health Market Science. All Rights Reserved.