Home / Function/ write() — netty Function Reference

write() — netty Function Reference

Architecture documentation for the write() function in QuicheQuicStreamChannel.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  3fb93988_b8ac_d344_5a9e_cea0a0997755["write()"]
  77188bb7_e7ad_de01_3b54_5bc50b9e2df1["QuicStreamChannelUnsafe"]
  3fb93988_b8ac_d344_5a9e_cea0a0997755 -->|defined in| 77188bb7_e7ad_de01_3b54_5bc50b9e2df1
  3382622d_156e_4ea8_6ee4_836b8e818890["isOpen()"]
  3fb93988_b8ac_d344_5a9e_cea0a0997755 -->|calls| 3382622d_156e_4ea8_6ee4_836b8e818890
  5664fc60_d754_d432_7618_03217bff78ba["queueAndFailAll()"]
  3fb93988_b8ac_d344_5a9e_cea0a0997755 -->|calls| 5664fc60_d754_d432_7618_03217bff78ba
  da5c2828_c8c5_6172_4f45_d61e57ed89ae["writeQueued()"]
  3fb93988_b8ac_d344_5a9e_cea0a0997755 -->|calls| da5c2828_c8c5_6172_4f45_d61e57ed89ae
  c225604c_2de8_fe76_73d8_f8ebd8b0d632["writeWithoutCheckChannelState()"]
  3fb93988_b8ac_d344_5a9e_cea0a0997755 -->|calls| c225604c_2de8_fe76_73d8_f8ebd8b0d632
  style 3fb93988_b8ac_d344_5a9e_cea0a0997755 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-classes-quic/src/main/java/io/netty/handler/codec/quic/QuicheQuicStreamChannel.java lines 722–756

        @Override
        public void write(Object msg, ChannelPromise promise) {
            assert eventLoop().inEventLoop();
            if (!promise.setUncancellable()) {
                ReferenceCountUtil.release(msg);
                return;
            }
            // Check first if the Channel is in a state in which it will accept writes, if not fail everything
            // with the right exception
            if (!isOpen()) {
                queueAndFailAll(msg, promise, new ClosedChannelException());
            } else if (finSent) {
                queueAndFailAll(msg, promise, new ChannelOutputShutdownException("Fin was sent already"));
            } else if (!queue.isEmpty()) {
                // If the queue is not empty we should just add the message to the queue as we will drain
                // it later once the stream becomes writable again.
                try {
                    msg = filterMsg(msg);
                } catch (UnsupportedOperationException e) {
                    ReferenceCountUtil.release(msg);
                    promise.setFailure(e);
                    return;
                }

                // Touch the message to make things easier in terms of debugging buffer leaks.
                ReferenceCountUtil.touch(msg);
                queue.add(msg, promise);

                // Try again to write queued messages.
                writeQueued();
            } else {
                assert queue.isEmpty();
                writeWithoutCheckChannelState(msg, promise);
            }
        }

Domain

Subdomains

Frequently Asked Questions

What does write() do?
write() is a function in the netty codebase, defined in codec-classes-quic/src/main/java/io/netty/handler/codec/quic/QuicheQuicStreamChannel.java.
Where is write() defined?
write() is defined in codec-classes-quic/src/main/java/io/netty/handler/codec/quic/QuicheQuicStreamChannel.java at line 722.
What does write() call?
write() calls 4 function(s): isOpen, queueAndFailAll, writeQueued, writeWithoutCheckChannelState.

Analyze Your Own Codebase

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

Try Supermodel Free