- java.lang.Object
-
- io.netty5.channel.PendingWriteQueue
-
public final class PendingWriteQueue extends Object
A queue of write operations which are pending for later execution.
-
-
Constructor Summary
Constructors Constructor Description PendingWriteQueue(EventExecutor executor, MessageSizeEstimator.Handle handle)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(Object msg, Promise<Void> promise)
Add the givenmsg
andPromise
.long
bytes()
Returns the total number of bytes that are pending because of pending messages.Object
current()
Return the current message ornull
if empty.boolean
isEmpty()
Returnstrue
if there are no pending write operations left in this queue.Promise<Void>
remove()
Removes a pending write operation and release its message viaResource.dispose(Object)
.void
removeAndFail(Throwable cause)
Remove a pending write operation and fail it with the givenThrowable
.void
removeAndFailAll(Throwable cause)
Remove all pending write operation and fail them with the givenThrowable
.Future<Void>
removeAndTransfer(Function<Object,Future<Void>> transferFunc)
Removes a pending write operation and performs it viaFunction.apply(Object)
.Future<Void>
removeAndTransferAll(Function<Object,Future<Void>> transferFunc)
Remove all pending write operation and performs them viaFunction.apply(Object)
.int
size()
Returns the number of pending write operations.
-
-
-
Constructor Detail
-
PendingWriteQueue
public PendingWriteQueue(EventExecutor executor, MessageSizeEstimator.Handle handle)
-
-
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.
-
removeAndTransferAll
public Future<Void> removeAndTransferAll(Function<Object,Future<Void>> transferFunc)
Remove all pending write operation and performs them viaFunction.apply(Object)
.- Returns:
Future
if something was transferred andnull
if thePendingWriteQueue
is empty.
-
removeAndFailAll
public void removeAndFailAll(Throwable cause)
Remove all pending write operation and fail them with the givenThrowable
. The message will be released viaResource.dispose(Object)
.
-
removeAndFail
public void removeAndFail(Throwable cause)
Remove a pending write operation and fail it with the givenThrowable
. The message will be released viaResource.dispose(Object)
.
-
removeAndTransfer
public Future<Void> removeAndTransfer(Function<Object,Future<Void>> transferFunc)
Removes a pending write operation and performs it viaFunction.apply(Object)
.- Returns:
Future
if something was transfered andnull
if thePendingWriteQueue
is empty.
-
remove
public Promise<Void> remove()
Removes a pending write operation and release its message viaResource.dispose(Object)
.- Returns:
Promise
of the pending write ornull
if the queue is empty.
-
current
public Object current()
Return the current message ornull
if empty.
-
-