Home / Function/ handle() — netty Function Reference

handle() — netty Function Reference

Architecture documentation for the handle() function in AbstractEpollChannel.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  2ab93c32_441f_8b46_a20b_b284364fb016["handle()"]
  48a4b0f2_9a93_c0ec_29eb_423e8fb5ce85["AbstractEpollUnsafe"]
  2ab93c32_441f_8b46_a20b_b284364fb016 -->|defined in| 48a4b0f2_9a93_c0ec_29eb_423e8fb5ce85
  0ff6908a_e49f_b5f9_0eaa_0238ef0f2863["epollOutReady()"]
  2ab93c32_441f_8b46_a20b_b284364fb016 -->|calls| 0ff6908a_e49f_b5f9_0eaa_0238ef0f2863
  4bcd90db_c084_162b_2a7a_36770794a97d["epollInReady()"]
  2ab93c32_441f_8b46_a20b_b284364fb016 -->|calls| 4bcd90db_c084_162b_2a7a_36770794a97d
  d090690c_ba63_7842_6536_a467e153f1b2["epollRdHupReady()"]
  2ab93c32_441f_8b46_a20b_b284364fb016 -->|calls| d090690c_ba63_7842_6536_a467e153f1b2
  style 2ab93c32_441f_8b46_a20b_b284364fb016 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

transport-classes-epoll/src/main/java/io/netty/channel/epoll/AbstractEpollChannel.java lines 452–491

        @Override
        public void handle(IoRegistration registration, IoEvent event) {
            EpollIoEvent epollEvent = (EpollIoEvent) event;
            int ops = epollEvent.ops().value;

            // Don't change the ordering of processing EPOLLOUT | EPOLLRDHUP / EPOLLIN if you're not 100%
            // sure about it!
            // Re-ordering can easily introduce bugs and bad side-effects, as we found out painfully in the
            // past.

            // First check for EPOLLOUT as we may need to fail the connect ChannelPromise before try
            // to read from the file descriptor.
            // See https://github.com/netty/netty/issues/3785
            //
            // It is possible for an EPOLLOUT or EPOLLERR to be generated when a connection is refused.
            // In either case epollOutReady() will do the correct thing (finish connecting, or fail
            // the connection).
            // See https://github.com/netty/netty/issues/3848
            if ((ops & EPOLL_ERR_OUT_MASK) != 0) {
                // Force flush of data as the epoll is writable again
                epollOutReady();
            }

            // Check EPOLLIN before EPOLLRDHUP to ensure all data is read before shutting down the input.
            // See https://github.com/netty/netty/issues/4317.
            //
            // If EPOLLIN or EPOLLERR was received and the channel is still open call epollInReady(). This will
            // try to read from the underlying file descriptor and so notify the user about the error.
            if ((ops & EPOLL_ERR_IN_MASK) != 0) {
                // The Channel is still open and there is something to read. Do it now.
                epollInReady();
            }

            // Check if EPOLLRDHUP was set, this will notify us for connection-reset in which case
            // we may close the channel directly or try to read more data depending on the state of the
            // Channel and als depending on the AbstractEpollChannel subtype.
            if ((ops & EPOLL_RDHUP_MASK) != 0) {
                epollRdHupReady();
            }
        }

Domain

Subdomains

Frequently Asked Questions

What does handle() do?
handle() is a function in the netty codebase, defined in transport-classes-epoll/src/main/java/io/netty/channel/epoll/AbstractEpollChannel.java.
Where is handle() defined?
handle() is defined in transport-classes-epoll/src/main/java/io/netty/channel/epoll/AbstractEpollChannel.java at line 452.
What does handle() call?
handle() calls 3 function(s): epollInReady, epollOutReady, epollRdHupReady.

Analyze Your Own Codebase

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

Try Supermodel Free