Home / Class/ NioSocketChannelUnsafe Class — netty Architecture

NioSocketChannelUnsafe Class — netty Architecture

Architecture documentation for the NioSocketChannelUnsafe class in NioSocketChannel.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  155e7c93_474f_eca9_c390_e67a42548650["NioSocketChannelUnsafe"]
  a898000e_03c9_ff60_bd2a_29311f236921["NioSocketChannel.java"]
  155e7c93_474f_eca9_c390_e67a42548650 -->|defined in| a898000e_03c9_ff60_bd2a_29311f236921
  9a3ed3e0_574a_33f6_7d39_ce4e3d1b9595["Executor()"]
  155e7c93_474f_eca9_c390_e67a42548650 -->|method| 9a3ed3e0_574a_33f6_7d39_ce4e3d1b9595

Relationship Graph

Source Code

transport/src/main/java/io/netty/channel/socket/nio/NioSocketChannel.java lines 446–465

    private final class NioSocketChannelUnsafe extends NioByteUnsafe {
        @Override
        protected Executor prepareToClose() {
            try {
                if (javaChannel().isOpen() && config().getSoLinger() > 0) {
                    // We need to cancel this key of the channel so we may not end up in a eventloop spin
                    // because we try to read or write until the actual close happens which may be later due
                    // SO_LINGER handling.
                    // See https://github.com/netty/netty/issues/4449
                    doDeregister();
                    return GlobalEventExecutor.INSTANCE;
                }
            } catch (Throwable ignore) {
                // Ignore the error as the underlying channel may be closed in the meantime and so
                // getSoLinger() may produce an exception. In this case we just return null.
                // See https://github.com/netty/netty/issues/4449
            }
            return null;
        }
    }

Frequently Asked Questions

What is the NioSocketChannelUnsafe class?
NioSocketChannelUnsafe is a class in the netty codebase, defined in transport/src/main/java/io/netty/channel/socket/nio/NioSocketChannel.java.
Where is NioSocketChannelUnsafe defined?
NioSocketChannelUnsafe is defined in transport/src/main/java/io/netty/channel/socket/nio/NioSocketChannel.java at line 446.

Analyze Your Own Codebase

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

Try Supermodel Free