Home / Class/ AbstractEpollChannel Class — netty Architecture

AbstractEpollChannel Class — netty Architecture

Architecture documentation for the AbstractEpollChannel class in AbstractEpollChannel.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  6a1b1970_2eef_b28f_03e7_8b11508deece["AbstractEpollChannel"]
  132fd5c4_77ce_b469_aad1_27fa2fbb41de["AbstractEpollChannel.java"]
  6a1b1970_2eef_b28f_03e7_8b11508deece -->|defined in| 132fd5c4_77ce_b469_aad1_27fa2fbb41de
  f630c23c_edd6_fa3b_3b57_76520ceafa17["AbstractEpollChannel()"]
  6a1b1970_2eef_b28f_03e7_8b11508deece -->|method| f630c23c_edd6_fa3b_3b57_76520ceafa17
  179c0f52_1d29_31f2_cc1d_5790b9d826a8["isSoErrorZero()"]
  6a1b1970_2eef_b28f_03e7_8b11508deece -->|method| 179c0f52_1d29_31f2_cc1d_5790b9d826a8
  183eb932_fb7f_4488_b2e8_71058cc21874["setFlag()"]
  6a1b1970_2eef_b28f_03e7_8b11508deece -->|method| 183eb932_fb7f_4488_b2e8_71058cc21874
  d7b9cff6_e957_5368_8766_17c20e4c829f["clearFlag()"]
  6a1b1970_2eef_b28f_03e7_8b11508deece -->|method| d7b9cff6_e957_5368_8766_17c20e4c829f
  d144099c_cc88_ae63_c6ca_9ed4dbc6811c["IoRegistration()"]
  6a1b1970_2eef_b28f_03e7_8b11508deece -->|method| d144099c_cc88_ae63_c6ca_9ed4dbc6811c
  53af3f3b_4a4a_7b54_3f4d_3df649326b08["isFlagSet()"]
  6a1b1970_2eef_b28f_03e7_8b11508deece -->|method| 53af3f3b_4a4a_7b54_3f4d_3df649326b08
  2f7cdb6d_28a7_9a18_d104_8e8ff9e7a0e9["FileDescriptor()"]
  6a1b1970_2eef_b28f_03e7_8b11508deece -->|method| 2f7cdb6d_28a7_9a18_d104_8e8ff9e7a0e9
  fdd43c4e_8b4c_5718_a91b_4d4a40bd77fd["EpollChannelConfig()"]
  6a1b1970_2eef_b28f_03e7_8b11508deece -->|method| fdd43c4e_8b4c_5718_a91b_4d4a40bd77fd
  e5df1ea4_b861_4381_789a_3b2851d17fe0["isActive()"]
  6a1b1970_2eef_b28f_03e7_8b11508deece -->|method| e5df1ea4_b861_4381_789a_3b2851d17fe0
  addad38d_9bfb_f0bb_9986_41f1a064492b["ChannelMetadata()"]
  6a1b1970_2eef_b28f_03e7_8b11508deece -->|method| addad38d_9bfb_f0bb_9986_41f1a064492b
  2baa241d_c24b_1b22_e723_0d15b4875e0f["doClose()"]
  6a1b1970_2eef_b28f_03e7_8b11508deece -->|method| 2baa241d_c24b_1b22_e723_0d15b4875e0f
  c18518d8_b171_2117_da91_3312525fc326["resetCachedAddresses()"]
  6a1b1970_2eef_b28f_03e7_8b11508deece -->|method| c18518d8_b171_2117_da91_3312525fc326
  52a85ca8_dc57_c9e7_0ed9_ba388bf8b6bb["doDisconnect()"]
  6a1b1970_2eef_b28f_03e7_8b11508deece -->|method| 52a85ca8_dc57_c9e7_0ed9_ba388bf8b6bb

Relationship Graph

Source Code

transport-classes-epoll/src/main/java/io/netty/channel/epoll/AbstractEpollChannel.java lines 66–849

abstract class AbstractEpollChannel extends AbstractChannel implements UnixChannel {
    private static final ChannelMetadata METADATA = new ChannelMetadata(false);
    protected final LinuxSocket socket;
    /**
     * The future of the current connection attempt.  If not null, subsequent
     * connection attempts will fail.
     */
    private ChannelPromise connectPromise;
    private Future<?> connectTimeoutFuture;
    private SocketAddress requestedRemoteAddress;
    private volatile SocketAddress local;
    private volatile SocketAddress remote;

    private IoRegistration registration;
    boolean inputClosedSeenErrorOnRead;
    private EpollIoOps ops;
    private EpollIoOps inital;

    protected volatile boolean active;

    AbstractEpollChannel(Channel parent, LinuxSocket fd, boolean active, EpollIoOps initialOps) {
        super(parent);
        this.socket = checkNotNull(fd, "fd");
        this.active = active;
        if (active) {
            // Directly cache the remote and local addresses
            // See https://github.com/netty/netty/issues/2359
            this.local = fd.localAddress();
            this.remote = fd.remoteAddress();
        }
        this.ops = initialOps;
    }

    AbstractEpollChannel(Channel parent, LinuxSocket fd, SocketAddress remote, EpollIoOps initialOps) {
        super(parent);
        this.socket = checkNotNull(fd, "fd");
        this.active = true;
        // Directly cache the remote and local addresses
        // See https://github.com/netty/netty/issues/2359
        this.remote = remote;
        this.local = fd.localAddress();
        this.ops = initialOps;
    }

    static boolean isSoErrorZero(Socket fd) {
        try {
            return fd.getSoError() == 0;
        } catch (IOException e) {
            throw new ChannelException(e);
        }
    }

    protected void setFlag(int flag) throws IOException {
        if (ops.contains(flag)) {
            // we can save a syscall if the ops did not change
            return;
        }
        ops = ops.with(EpollIoOps.valueOf(flag));
        if (isRegistered()) {
            IoRegistration registration = registration();
            registration.submit(ops);
        } else {
            ops = ops.with(EpollIoOps.valueOf(flag));
        }
    }

    void clearFlag(int flag) throws IOException {
        IoRegistration registration = registration();
        if (!ops.contains(flag)) {
            // we can save a syscall if the ops did not change
            return;
        }
        ops = ops.without(EpollIoOps.valueOf(flag));
        registration.submit(ops);
    }

    protected final IoRegistration registration() {
        assert registration != null;
        return registration;
    }

Frequently Asked Questions

What is the AbstractEpollChannel class?
AbstractEpollChannel is a class in the netty codebase, defined in transport-classes-epoll/src/main/java/io/netty/channel/epoll/AbstractEpollChannel.java.
Where is AbstractEpollChannel defined?
AbstractEpollChannel is defined in transport-classes-epoll/src/main/java/io/netty/channel/epoll/AbstractEpollChannel.java at line 66.

Analyze Your Own Codebase

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

Try Supermodel Free