- 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 voidadd(Object msg, Promise<Void> promise)Add the givenmsgandPromise.longbytes()Returns the total number of bytes that are pending because of pending messages.Objectcurrent()Return the current message ornullif empty.booleanisEmpty()Returnstrueif 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).voidremoveAndFail(Throwable cause)Remove a pending write operation and fail it with the givenThrowable.voidremoveAndFailAll(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).intsize()Returns the number of pending write operations.
-
-
-
Constructor Detail
-
PendingWriteQueue
public PendingWriteQueue(EventExecutor executor, MessageSizeEstimator.Handle handle)
-
-
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.
-
removeAndTransferAll
public Future<Void> removeAndTransferAll(Function<Object,Future<Void>> transferFunc)
Remove all pending write operation and performs them viaFunction.apply(Object).- Returns:
Futureif something was transferred andnullif thePendingWriteQueueis 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:
Futureif something was transfered andnullif thePendingWriteQueueis empty.
-
remove
public Promise<Void> remove()
Removes a pending write operation and release its message viaResource.dispose(Object).- Returns:
Promiseof the pending write ornullif the queue is empty.
-
current
public Object current()
Return the current message ornullif empty.
-
-