Package io.netty.channel
Class PendingWriteQueue
- java.lang.Object
-
- io.netty.channel.PendingWriteQueue
-
public final class PendingWriteQueue extends java.lang.Object
A queue of write operations which are pending for later execution. It also updates the writability of the associatedChannel
, so that the pending write operations are also considered to determine the writability.
-
-
Constructor Summary
Constructors Constructor Description PendingWriteQueue(Channel channel)
PendingWriteQueue(ChannelHandlerContext ctx)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(java.lang.Object msg, ChannelPromise promise)
Add the givenmsg
andChannelPromise
.long
bytes()
Returns the total number of bytes that are pending because of pending messages.java.lang.Object
current()
Return the current message ornull
if empty.boolean
isEmpty()
Returnstrue
if there are no pending write operations left in this queue.ChannelPromise
remove()
Removes a pending write operation and release it's message viaReferenceCountUtil.safeRelease(Object)
.void
removeAndFail(java.lang.Throwable cause)
Remove a pending write operation and fail it with the givenThrowable
.void
removeAndFailAll(java.lang.Throwable cause)
Remove all pending write operation and fail them with the givenThrowable
.ChannelFuture
removeAndWrite()
Removes a pending write operation and performs it viaChannelOutboundInvoker.write(Object, ChannelPromise)
.ChannelFuture
removeAndWriteAll()
Remove all pending write operation and performs them viaChannelOutboundInvoker.write(Object, ChannelPromise)
.int
size()
Returns the number of pending write operations.
-
-
-
Constructor Detail
-
PendingWriteQueue
public PendingWriteQueue(ChannelHandlerContext ctx)
-
PendingWriteQueue
public PendingWriteQueue(Channel channel)
-
-
Method Detail
-
isEmpty
public boolean isEmpty()
Returnstrue
if there are no pending write operations left in this queue.
-
size
public int size()
Returns the number of pending write operations.
-
bytes
public long bytes()
Returns the total number of bytes that are pending because of pending messages. This is only an estimate so it should only be treated as a hint.
-
add
public void add(java.lang.Object msg, ChannelPromise promise)
Add the givenmsg
andChannelPromise
.
-
removeAndWriteAll
public ChannelFuture removeAndWriteAll()
Remove all pending write operation and performs them viaChannelOutboundInvoker.write(Object, ChannelPromise)
.- Returns:
ChannelFuture
if something was written andnull
if thePendingWriteQueue
is empty.
-
removeAndFailAll
public void removeAndFailAll(java.lang.Throwable cause)
Remove all pending write operation and fail them with the givenThrowable
. The message will be released viaReferenceCountUtil.safeRelease(Object)
.
-
removeAndFail
public void removeAndFail(java.lang.Throwable cause)
Remove a pending write operation and fail it with the givenThrowable
. The message will be released viaReferenceCountUtil.safeRelease(Object)
.
-
removeAndWrite
public ChannelFuture removeAndWrite()
Removes a pending write operation and performs it viaChannelOutboundInvoker.write(Object, ChannelPromise)
.- Returns:
ChannelFuture
if something was written andnull
if thePendingWriteQueue
is empty.
-
remove
public ChannelPromise remove()
Removes a pending write operation and release it's message viaReferenceCountUtil.safeRelease(Object)
.- Returns:
ChannelPromise
of the pending write ornull
if the queue is empty.
-
current
public java.lang.Object current()
Return the current message ornull
if empty.
-
-