Package io.netty.channel
Class PendingWriteQueue
- java.lang.Object
-
- io.netty.channel.PendingWriteQueue
-
public final class PendingWriteQueue extends java.lang.ObjectA 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 voidadd(java.lang.Object msg, ChannelPromise promise)Add the givenmsgandChannelPromise.longbytes()Returns the total number of bytes that are pending because of pending messages.java.lang.Objectcurrent()Return the current message ornullif empty.booleanisEmpty()Returnstrueif there are no pending write operations left in this queue.ChannelPromiseremove()Removes a pending write operation and release it's message viaReferenceCountUtil.safeRelease(Object).voidremoveAndFail(java.lang.Throwable cause)Remove a pending write operation and fail it with the givenThrowable.voidremoveAndFailAll(java.lang.Throwable cause)Remove all pending write operation and fail them with the givenThrowable.ChannelFutureremoveAndWrite()Removes a pending write operation and performs it viaChannelOutboundInvoker.write(Object, ChannelPromise).ChannelFutureremoveAndWriteAll()Remove all pending write operation and performs them viaChannelOutboundInvoker.write(Object, ChannelPromise).intsize()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()
Returnstrueif 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 givenmsgandChannelPromise.
-
removeAndWriteAll
public ChannelFuture removeAndWriteAll()
Remove all pending write operation and performs them viaChannelOutboundInvoker.write(Object, ChannelPromise).- Returns:
ChannelFutureif something was written andnullif thePendingWriteQueueis 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:
ChannelFutureif something was written andnullif thePendingWriteQueueis empty.
-
remove
public ChannelPromise remove()
Removes a pending write operation and release it's message viaReferenceCountUtil.safeRelease(Object).- Returns:
ChannelPromiseof the pending write ornullif the queue is empty.
-
current
public java.lang.Object current()
Return the current message ornullif empty.
-
-