Top Description Inners Fields Constructors Methods
io.netty.channel

public final Class PendingWriteQueue

extends Object
Class Inheritance
Imports
io.netty.buffer.AbstractReferenceCountedByteBuf, io.netty.util.ReferenceCountUtil, io.netty.util.concurrent.EventExecutor, .PromiseCombiner, io.netty.util.internal.ObjectPool, .ObjectPool.ObjectCreator, .ObjectUtil, .SystemPropertyUtil, io.netty.util.internal.logging.InternalLogger, .InternalLoggerFactory

A queue of write operations which are pending for later execution. It also updates the writability of the associated Channel, so that the pending write operations are also considered to determine the writability.

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class
PendingWriteQueue.PendingWrite

Holds all meta-data and construct the linked-list structure.

Field Summary

Modifier and TypeField and Description
private long
private final EventExecutor
private PendingWriteQueue.PendingWrite
private final ChannelOutboundInvoker
private static final InternalLogger
private static final int
private int
private PendingWriteQueue.PendingWrite
private final PendingBytesTracker

Constructor Summary

AccessConstructor and Description
public
public

Method Summary

Modifier and TypeMethod and Description
public void
add(Object msg, ChannelPromise promise)

Add the given msg and ChannelPromise.

private void
public long
bytes()

Returns the total number of bytes that are pending because of pending messages.

public Object
current()

Return the current message or null if empty.

public boolean
isEmpty()

Returns true if there are no pending write operations left in this queue.

private void
recycle(PendingWriteQueue.PendingWrite write, boolean update)

public ChannelPromise

Returns:

ChannelPromise of the pending write or null if the queue is empty.
remove
()

Removes a pending write operation and release it's message via ReferenceCountUtil#safeRelease(Object).

public void
removeAndFail(Throwable cause)

Remove a pending write operation and fail it with the given Throwable.

public void
removeAndFailAll(Throwable cause)

Remove all pending write operation and fail them with the given Throwable.

public ChannelFuture

Returns:

ChannelFuture if something was written and null if the PendingWriteQueue is empty.
removeAndWrite
()

Removes a pending write operation and performs it via ChannelHandlerContext#write(Object, ChannelPromise).

public ChannelFuture

Returns:

ChannelFuture if something was written and null if the PendingWriteQueue is empty.
removeAndWriteAll
()

Remove all pending write operation and performs them via ChannelHandlerContext#write(Object, ChannelPromise).

private static void
public int
size()

Returns the number of pending write operations.

private int
size(Object msg)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

bytesback to summary
private long bytes
executorback to summary
private final EventExecutor executor
invokerback to summary
private final ChannelOutboundInvoker invoker
loggerback to summary
private static final InternalLogger logger
PENDING_WRITE_OVERHEADback to summary
private static final int PENDING_WRITE_OVERHEAD
sizeback to summary
private int size
tailback to summary
private PendingWriteQueue.PendingWrite tail
trackerback to summary
private final PendingBytesTracker tracker

Constructor Detail

PendingWriteQueueback to summary
public PendingWriteQueue(ChannelHandlerContext ctx)
PendingWriteQueueback to summary
public PendingWriteQueue(Channel channel)

Method Detail

addback to summary
public void add(Object msg, ChannelPromise promise)

Add the given msg and ChannelPromise.

assertEmptyback to summary
private void assertEmpty()
bytesback to summary
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.

currentback to summary
public Object current()

Return the current message or null if empty.

isEmptyback to summary
public boolean isEmpty()

Returns true if there are no pending write operations left in this queue.

recycleback to summary
private void recycle(PendingWriteQueue.PendingWrite write, boolean update)
removeback to summary
public ChannelPromise remove()

Removes a pending write operation and release it's message via ReferenceCountUtil#safeRelease(Object).

Returns:ChannelPromise

ChannelPromise of the pending write or null if the queue is empty.

removeAndFailback to summary
public void removeAndFail(Throwable cause)

Remove a pending write operation and fail it with the given Throwable. The message will be released via ReferenceCountUtil#safeRelease(Object).

removeAndFailAllback to summary
public void removeAndFailAll(Throwable cause)

Remove all pending write operation and fail them with the given Throwable. The message will be released via ReferenceCountUtil#safeRelease(Object).

removeAndWriteback to summary
public ChannelFuture removeAndWrite()

Removes a pending write operation and performs it via ChannelHandlerContext#write(Object, ChannelPromise).

Returns:ChannelFuture

ChannelFuture if something was written and null if the PendingWriteQueue is empty.

removeAndWriteAllback to summary
public ChannelFuture removeAndWriteAll()

Remove all pending write operation and performs them via ChannelHandlerContext#write(Object, ChannelPromise).

Returns:ChannelFuture

ChannelFuture if something was written and null if the PendingWriteQueue is empty.

safeFailback to summary
private static void safeFail(ChannelPromise promise, Throwable cause)
sizeback to summary
public int size()

Returns the number of pending write operations.

sizeback to summary
private int size(Object msg)
io.netty.channel back to summary

pack-priv final Class PendingWriteQueue.PendingWrite

extends Object
Class Inheritance

Holds all meta-data and construct the linked-list structure.

Field Summary

Modifier and TypeField and Description
private final ObjectPool.Handle<PendingWriteQueue.PendingWrite>
private Object
private PendingWriteQueue.PendingWrite
private ChannelPromise
private static final ObjectPool<PendingWriteQueue.PendingWrite>
private long

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
pack-priv static PendingWriteQueue.PendingWrite
newInstance(Object msg, int size, ChannelPromise promise)

private void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

handleback to summary
private final ObjectPool.Handle<PendingWriteQueue.PendingWrite> handle
msgback to summary
private Object msg
nextback to summary
private PendingWriteQueue.PendingWrite next
promiseback to summary
private ChannelPromise promise
RECYCLERback to summary
private static final ObjectPool<PendingWriteQueue.PendingWrite> RECYCLER
sizeback to summary
private long size

Constructor Detail

PendingWriteback to summary
private PendingWrite(ObjectPool.Handle<PendingWriteQueue.PendingWrite> handle)

Method Detail

newInstanceback to summary
pack-priv static PendingWriteQueue.PendingWrite newInstance(Object msg, int size, ChannelPromise promise)
recycleback to summary
private void recycle()