public class ChannelAsyncOutputStream extends AbstractCloseable implements IoOutputStream, ChannelHolder
AbstractCloseable.State| Modifier and Type | Field and Description |
|---|---|
private Channel |
channelInstance |
private byte |
cmd |
private java.lang.Object |
packetWriteId |
private PacketWriter |
packetWriter |
private java.util.concurrent.atomic.AtomicReference<IoWriteFutureImpl> |
pendingWrite |
closeFuture, futureLock, statelogCLOSE_WAIT_TIMEOUT, DEFAULT_CLOSE_WAIT_TIMEOUT| Constructor and Description |
|---|
ChannelAsyncOutputStream(Channel channel,
byte cmd) |
| Modifier and Type | Method and Description |
|---|---|
protected Buffer |
createSendBuffer(Buffer buffer,
Channel channel,
long length) |
protected CloseFuture |
doCloseGracefully() |
protected void |
doWriteIfPossible(boolean resume) |
Channel |
getChannel() |
void |
onWindowExpanded() |
protected void |
onWritten(IoWriteFutureImpl future,
int total,
long length,
IoWriteFuture f) |
protected void |
preClose()
preClose is guaranteed to be called before doCloseGracefully or doCloseImmediately.
|
java.lang.String |
toString() |
IoWriteFuture |
writePacket(Buffer buffer)
Encode and send the given buffer.
|
addCloseFutureListener, builder, close, doCloseImmediately, getFutureLock, isClosed, isClosing, removeCloseFutureListenergetSimplifiedLoggerclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitaddCloseFutureListener, close, close, close, getMaxCloseWaitTime, isClosed, isClosing, isOpen, removeCloseFutureListenercalculatePadLengthprivate final Channel channelInstance
private final PacketWriter packetWriter
private final byte cmd
private final java.util.concurrent.atomic.AtomicReference<IoWriteFutureImpl> pendingWrite
private final java.lang.Object packetWriteId
public ChannelAsyncOutputStream(Channel channel, byte cmd)
public Channel getChannel()
getChannel in interface ChannelHolderChannel instancepublic void onWindowExpanded()
throws java.io.IOException
java.io.IOExceptionpublic IoWriteFuture writePacket(Buffer buffer) throws java.io.IOException
PacketWriterwritePacket in interface PacketWriterbuffer - the buffer to encode and send. NOTE: the buffer must not be touched until the returned
write future is completed.IoWriteFuture that can be used to check when the packet has actually been sentjava.io.IOException - if an error occurred when encoding sending the packetprotected void preClose()
AbstractCloseablepreClose in class AbstractCloseableprotected CloseFuture doCloseGracefully()
doCloseGracefully in class AbstractCloseableprotected void doWriteIfPossible(boolean resume)
protected void onWritten(IoWriteFutureImpl future, int total, long length, IoWriteFuture f)
public java.lang.String toString()
toString in class java.lang.Object