public final class PendingWriteQueue
extends java.lang.Object
Channel
, so that
the pending write operations are also considered to determine the writability.Modifier and Type | Class and Description |
---|---|
(package private) static class |
PendingWriteQueue.PendingWrite
Holds all meta-data and construct the linked-list structure.
|
Modifier and Type | Field and Description |
---|---|
private ChannelOutboundBuffer |
buffer |
private long |
bytes |
private ChannelHandlerContext |
ctx |
private MessageSizeEstimator.Handle |
estimatorHandle |
private PendingWriteQueue.PendingWrite |
head |
private static InternalLogger |
logger |
private int |
size |
private PendingWriteQueue.PendingWrite |
tail |
Constructor and Description |
---|
PendingWriteQueue(ChannelHandlerContext ctx) |
Modifier and Type | Method and Description |
---|---|
void |
add(java.lang.Object msg,
ChannelPromise promise)
Add the given
msg and ChannelPromise . |
private void |
assertEmpty() |
long |
bytes()
Returns the total number of bytes that are pending because of pending messages.
|
java.lang.Object |
current()
Return the current message or
null if empty. |
boolean |
isEmpty()
Returns
true if there are no pending write operations left in this queue. |
private void |
recycle(PendingWriteQueue.PendingWrite write,
boolean update) |
ChannelPromise |
remove()
Removes a pending write operation and release it's message via
ReferenceCountUtil.safeRelease(Object) . |
void |
removeAndFail(java.lang.Throwable cause)
Remove a pending write operation and fail it with the given
Throwable . |
void |
removeAndFailAll(java.lang.Throwable cause)
Remove all pending write operation and fail them with the given
Throwable . |
ChannelFuture |
removeAndWrite()
Removes a pending write operation and performs it via
ChannelHandlerContext.write(Object, ChannelPromise) . |
ChannelFuture |
removeAndWriteAll()
Remove all pending write operation and performs them via
ChannelHandlerContext.write(Object, ChannelPromise) . |
private static void |
safeFail(ChannelPromise promise,
java.lang.Throwable cause) |
int |
size()
Returns the number of pending write operations.
|
private static final InternalLogger logger
private final ChannelHandlerContext ctx
private final ChannelOutboundBuffer buffer
private final MessageSizeEstimator.Handle estimatorHandle
private PendingWriteQueue.PendingWrite head
private PendingWriteQueue.PendingWrite tail
private int size
private long bytes
public PendingWriteQueue(ChannelHandlerContext ctx)
public boolean isEmpty()
true
if there are no pending write operations left in this queue.public int size()
public long bytes()
public void add(java.lang.Object msg, ChannelPromise promise)
msg
and ChannelPromise
.public ChannelFuture removeAndWriteAll()
ChannelHandlerContext.write(Object, ChannelPromise)
.ChannelFuture
if something was written and null
if the PendingWriteQueue
is empty.public void removeAndFailAll(java.lang.Throwable cause)
Throwable
. The message will be released
via ReferenceCountUtil.safeRelease(Object)
.public void removeAndFail(java.lang.Throwable cause)
Throwable
. The message will be released via
ReferenceCountUtil.safeRelease(Object)
.private void assertEmpty()
public ChannelFuture removeAndWrite()
ChannelHandlerContext.write(Object, ChannelPromise)
.ChannelFuture
if something was written and null
if the PendingWriteQueue
is empty.public ChannelPromise remove()
ReferenceCountUtil.safeRelease(Object)
.ChannelPromise
of the pending write or null
if the queue is empty.public java.lang.Object current()
null
if empty.private void recycle(PendingWriteQueue.PendingWrite write, boolean update)
private static void safeFail(ChannelPromise promise, java.lang.Throwable cause)