public class AsyncMessageOutputPlus extends AsyncChannelOutputPlus
DataOutputStreamPlus
that writes ASYNCHRONOUSLY to a Netty Channel.
Intended as single use, to write one (large) message.
The close() and flush() methods synchronously wait for pending writes, and will propagate any exceptions
encountered in writing them to the wire.
The correctness of this class depends on the ChannelPromise we create against a Channel always being completed,
which appears to be a guarantee provided by Netty so long as the event loop is running.AsyncChannelOutputPlus.FlushException
buffer
Modifier and Type | Method and Description |
---|---|
void |
close()
Flush any remaining writes, and release any buffers.
|
void |
discard()
Discard any buffered data, and the buffers that contain it.
|
protected void |
doFlush(int count) |
long |
position()
Returns the current position of the underlying target like a file-pointer
or the position withing a buffer.
|
beginFlush, flush, flushed, flushedToNetwork, newDefaultChannel, parkUntilFlushed, releaseSpace
order, write, write, write, write, writeBoolean, writeByte, writeBytes, writeChar, writeChars, writeDouble, writeFloat, writeInt, writeLong, writeShort, writeUTF
retrieveTemporaryBuffer
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
hasPosition, write, writeUnsignedVInt, writeVInt
protected void doFlush(int count) throws java.io.IOException
doFlush
in class AsyncChannelOutputPlus
java.io.IOException
public void close() throws java.io.IOException
AsyncChannelOutputPlus
AsyncChannelOutputPlus.flushFailed
, which will propagate them to the producer thread no later than its
final invocation to AsyncChannelOutputPlus.close()
or AsyncChannelOutputPlus.flush()
(that must not be followed by any further writes).close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in class AsyncChannelOutputPlus
java.io.IOException
public long position()
DataOutputPlus
DataOutputPlus.hasPosition()
.position
in interface DataOutputPlus
position
in class AsyncChannelOutputPlus
public void discard()
close()
if we terminate exceptionally.discard
in class AsyncChannelOutputPlus
Copyright © 2009-2021 The Apache Software Foundation