Home / Function/ writeAndRemoveAll() — netty Function Reference

writeAndRemoveAll() — netty Function Reference

Architecture documentation for the writeAndRemoveAll() function in AbstractCoalescingBufferQueue.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  467c8c19_eff1_c3a2_43ff_78745ae64293["writeAndRemoveAll()"]
  ed411aca_4554_3a54_c59f_b4c69a0bca4f["AbstractCoalescingBufferQueue"]
  467c8c19_eff1_c3a2_43ff_78745ae64293 -->|defined in| ed411aca_4554_3a54_c59f_b4c69a0bca4f
  fa46d01c_05f6_24a4_75e1_80bf5d5a22dc["decrementReadableBytes()"]
  467c8c19_eff1_c3a2_43ff_78745ae64293 -->|calls| fa46d01c_05f6_24a4_75e1_80bf5d5a22dc
  40b2d7ee_ab69_691f_b3f0_be44cf83b193["readableBytes()"]
  467c8c19_eff1_c3a2_43ff_78745ae64293 -->|calls| 40b2d7ee_ab69_691f_b3f0_be44cf83b193
  style 467c8c19_eff1_c3a2_43ff_78745ae64293 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

transport/src/main/java/io/netty/channel/AbstractCoalescingBufferQueue.java lines 255–295

    public final void writeAndRemoveAll(ChannelHandlerContext ctx) {
        Throwable pending = null;
        ByteBuf previousBuf = null;
        for (;;) {
            Object entry = bufAndListenerPairs.poll();
            try {
                if (entry == null) {
                    if (previousBuf != null) {
                        decrementReadableBytes(previousBuf.readableBytes());
                        ctx.write(previousBuf, ctx.voidPromise());
                    }
                    break;
                }

                if (entry instanceof ByteBuf) {
                    if (previousBuf != null) {
                        decrementReadableBytes(previousBuf.readableBytes());
                        ctx.write(previousBuf, ctx.voidPromise());
                    }
                    previousBuf = (ByteBuf) entry;
                } else if (entry instanceof ChannelPromise) {
                    decrementReadableBytes(previousBuf.readableBytes());
                    ctx.write(previousBuf, (ChannelPromise) entry);
                    previousBuf = null;
                } else {
                    decrementReadableBytes(previousBuf.readableBytes());
                    ctx.write(previousBuf).addListener((ChannelFutureListener) entry);
                    previousBuf = null;
                }
            } catch (Throwable t) {
                if (pending == null) {
                    pending = t;
                } else {
                    logger.info("Throwable being suppressed because Throwable {} is already pending", pending, t);
                }
            }
        }
        if (pending != null) {
            throw new IllegalStateException(pending);
        }
    }

Domain

Subdomains

Frequently Asked Questions

What does writeAndRemoveAll() do?
writeAndRemoveAll() is a function in the netty codebase, defined in transport/src/main/java/io/netty/channel/AbstractCoalescingBufferQueue.java.
Where is writeAndRemoveAll() defined?
writeAndRemoveAll() is defined in transport/src/main/java/io/netty/channel/AbstractCoalescingBufferQueue.java at line 255.
What does writeAndRemoveAll() call?
writeAndRemoveAll() calls 2 function(s): decrementReadableBytes, readableBytes.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free