Home / Function/ doBeginRead() — netty Function Reference

doBeginRead() — netty Function Reference

Architecture documentation for the doBeginRead() function in AbstractHttp2StreamChannel.java from the netty codebase.

Function java Buffer Allocators calls 8 called by 2

Entity Profile

Dependency Diagram

graph TD
  8c7ec287_e512_c36c_39d6_33286068a273["doBeginRead()"]
  2656dcfe_5cdb_7c7d_bc25_312393fe2e05["Http2ChannelUnsafe"]
  8c7ec287_e512_c36c_39d6_33286068a273 -->|defined in| 2656dcfe_5cdb_7c7d_bc25_312393fe2e05
  743f5577_bb22_31db_6036_66e3afe5136f["streamClosed()"]
  743f5577_bb22_31db_6036_66e3afe5136f -->|calls| 8c7ec287_e512_c36c_39d6_33286068a273
  3a18b33a_f9a8_0622_5d3c_59bf383e0e3a["beginRead()"]
  3a18b33a_f9a8_0622_5d3c_59bf383e0e3a -->|calls| 8c7ec287_e512_c36c_39d6_33286068a273
  17bb5ba9_6675_72af_80ec_e5f5d89f1f8c["flush()"]
  8c7ec287_e512_c36c_39d6_33286068a273 -->|calls| 17bb5ba9_6675_72af_80ec_e5f5d89f1f8c
  8a1829a9_4ff0_0fdc_6f6f_98fc1f844f84["closeForcibly()"]
  8c7ec287_e512_c36c_39d6_33286068a273 -->|calls| 8a1829a9_4ff0_0fdc_6f6f_98fc1f844f84
  061edcf4_92d7_3247_2f08_9c8c996847ae["recvBufAllocHandle()"]
  8c7ec287_e512_c36c_39d6_33286068a273 -->|calls| 061edcf4_92d7_3247_2f08_9c8c996847ae
  a7768b47_c66a_4661_7c15_67b72fe39d9e["doRead0()"]
  8c7ec287_e512_c36c_39d6_33286068a273 -->|calls| a7768b47_c66a_4661_7c15_67b72fe39d9e
  a362ae20_c4ae_22d2_1fdc_4d606b3e40cd["isParentReadInProgress()"]
  8c7ec287_e512_c36c_39d6_33286068a273 -->|calls| a362ae20_c4ae_22d2_1fdc_4d606b3e40cd
  c954e160_2528_2625_d619_97b80679651a["maybeAddChannelToReadCompletePendingQueue()"]
  8c7ec287_e512_c36c_39d6_33286068a273 -->|calls| c954e160_2528_2625_d619_97b80679651a
  4373f9ff_b341_55e0_625c_45e60ac17922["notifyReadComplete()"]
  8c7ec287_e512_c36c_39d6_33286068a273 -->|calls| 4373f9ff_b341_55e0_625c_45e60ac17922
  7d8bf346_9376_a06b_6a18_a4a512830328["resetReadStatus()"]
  8c7ec287_e512_c36c_39d6_33286068a273 -->|calls| 7d8bf346_9376_a06b_6a18_a4a512830328
  style 8c7ec287_e512_c36c_39d6_33286068a273 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-http2/src/main/java/io/netty/handler/codec/http2/AbstractHttp2StreamChannel.java lines 864–907

        void doBeginRead() {
            if (readStatus == ReadStatus.IDLE) {
                // Don't wait for the user to request a read to notify of channel closure.
                if (readEOS && (inboundBuffer == null || inboundBuffer.isEmpty())) {
                    // Double check there is nothing left to flush such as a window update frame.
                    flush();
                    unsafe.closeForcibly();
                }
            } else {
                do { // Process messages until there are none left (or the user stopped requesting) and also handle EOS.
                    Object message = pollQueuedMessage();
                    if (message == null) {
                        // Double check there is nothing left to flush such as a window update frame.
                        flush();
                        if (readEOS) {
                            unsafe.closeForcibly();
                        }
                        break;
                    }
                    final RecvByteBufAllocator.Handle allocHandle = recvBufAllocHandle();
                    allocHandle.reset(config());
                    boolean continueReading = false;
                    do {
                        doRead0((Http2Frame) message, allocHandle);
                    } while ((readEOS || (continueReading = allocHandle.continueReading()))
                            && (message = pollQueuedMessage()) != null);

                    if (continueReading && isParentReadInProgress() && !readEOS) {
                        // Currently the parent and child channel are on the same EventLoop thread. If the parent is
                        // currently reading it is possible that more frames will be delivered to this child channel. In
                        // the case that this child channel still wants to read we delay the channelReadComplete on this
                        // child channel until the parent is done reading.
                        maybeAddChannelToReadCompletePendingQueue();
                    } else {
                        notifyReadComplete(allocHandle, true, true);

                        // While in the read loop reset the readState AFTER calling readComplete (or other pipeline
                        // callbacks) to prevents re-entry into this method (if autoRead is disabled and the user calls
                        // read on each readComplete) and StackOverflowException.
                        resetReadStatus();
                    }
                } while (readStatus != ReadStatus.IDLE);
            }
        }

Domain

Subdomains

Frequently Asked Questions

What does doBeginRead() do?
doBeginRead() is a function in the netty codebase, defined in codec-http2/src/main/java/io/netty/handler/codec/http2/AbstractHttp2StreamChannel.java.
Where is doBeginRead() defined?
doBeginRead() is defined in codec-http2/src/main/java/io/netty/handler/codec/http2/AbstractHttp2StreamChannel.java at line 864.
What does doBeginRead() call?
doBeginRead() calls 8 function(s): closeForcibly, doRead0, flush, isParentReadInProgress, maybeAddChannelToReadCompletePendingQueue, notifyReadComplete, recvBufAllocHandle, resetReadStatus.
What calls doBeginRead()?
doBeginRead() is called by 2 function(s): beginRead, streamClosed.

Analyze Your Own Codebase

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

Try Supermodel Free