Home / Function/ ChannelFuture() — netty Function Reference

ChannelFuture() — netty Function Reference

Architecture documentation for the ChannelFuture() function in PendingWriteQueue.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  58e262d9_3782_2194_e391_e963af8a705d["ChannelFuture()"]
  83722386_341f_50b9_cd3a_d141138801ae["PendingWriteQueue"]
  58e262d9_3782_2194_e391_e963af8a705d -->|defined in| 83722386_341f_50b9_cd3a_d141138801ae
  ff536e40_0a4b_12c0_e94e_a2a0413256fb["isEmpty()"]
  58e262d9_3782_2194_e391_e963af8a705d -->|calls| ff536e40_0a4b_12c0_e94e_a2a0413256fb
  9045a57d_5230_2357_4ef7_f61e7cee74ba["add()"]
  58e262d9_3782_2194_e391_e963af8a705d -->|calls| 9045a57d_5230_2357_4ef7_f61e7cee74ba
  2c764cb5_1103_a5d1_4774_278972921504["assertEmpty()"]
  58e262d9_3782_2194_e391_e963af8a705d -->|calls| 2c764cb5_1103_a5d1_4774_278972921504
  d80642d8_7dc6_939b_e48a_94fa31dc8c25["recycle()"]
  58e262d9_3782_2194_e391_e963af8a705d -->|calls| d80642d8_7dc6_939b_e48a_94fa31dc8c25
  style 58e262d9_3782_2194_e391_e963af8a705d fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

transport/src/main/java/io/netty/channel/PendingWriteQueue.java lines 141–176

    public ChannelFuture removeAndWriteAll() {
        assert executor.inEventLoop();

        if (isEmpty()) {
            return null;
        }

        ChannelPromise p = invoker.newPromise();
        PromiseCombiner combiner = new PromiseCombiner(executor);
        try {
            // It is possible for some of the written promises to trigger more writes. The new writes
            // will "revive" the queue, so we need to write them up until the queue is empty.
            for (PendingWrite write = head; write != null; write = head) {
                head = tail = null;
                size = 0;
                bytes = 0;

                while (write != null) {
                    PendingWrite next = write.next;
                    Object msg = write.msg;
                    ChannelPromise promise = write.promise;
                    recycle(write, false);
                    if (!(promise instanceof VoidChannelPromise)) {
                        combiner.add(promise);
                    }
                    invoker.write(msg, promise);
                    write = next;
                }
            }
            combiner.finish(p);
        } catch (Throwable cause) {
            p.setFailure(cause);
        }
        assertEmpty();
        return p;
    }

Domain

Subdomains

Frequently Asked Questions

What does ChannelFuture() do?
ChannelFuture() is a function in the netty codebase, defined in transport/src/main/java/io/netty/channel/PendingWriteQueue.java.
Where is ChannelFuture() defined?
ChannelFuture() is defined in transport/src/main/java/io/netty/channel/PendingWriteQueue.java at line 141.
What does ChannelFuture() call?
ChannelFuture() calls 4 function(s): add, assertEmpty, isEmpty, recycle.

Analyze Your Own Codebase

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

Try Supermodel Free