Home / Class/ OioSocketChannel Class — netty Architecture

OioSocketChannel Class — netty Architecture

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

Entity Profile

Dependency Diagram

graph TD
  c458e276_eaf3_4567_04e0_b5864fe60240["OioSocketChannel"]
  f5f2608a_fe4c_a4e4_5b9b_dcaa2b98d52a["OioSocketChannel.java"]
  c458e276_eaf3_4567_04e0_b5864fe60240 -->|defined in| f5f2608a_fe4c_a4e4_5b9b_dcaa2b98d52a
  e5061f28_5d92_7aa1_fdd7_6cb98c93d080["OioSocketChannel()"]
  c458e276_eaf3_4567_04e0_b5864fe60240 -->|method| e5061f28_5d92_7aa1_fdd7_6cb98c93d080
  08b81ff9_63ee_c895_acb9_53489ec63092["ServerSocketChannel()"]
  c458e276_eaf3_4567_04e0_b5864fe60240 -->|method| 08b81ff9_63ee_c895_acb9_53489ec63092
  7df51bfc_49ac_af67_ac8b_ae3b2e803b1c["OioSocketChannelConfig()"]
  c458e276_eaf3_4567_04e0_b5864fe60240 -->|method| 7df51bfc_49ac_af67_ac8b_ae3b2e803b1c
  aecb9e1d_82eb_26f1_e267_fe813962d6da["isOpen()"]
  c458e276_eaf3_4567_04e0_b5864fe60240 -->|method| aecb9e1d_82eb_26f1_e267_fe813962d6da
  09d82f30_e92b_32d0_bbc2_98c37d69a244["isActive()"]
  c458e276_eaf3_4567_04e0_b5864fe60240 -->|method| 09d82f30_e92b_32d0_bbc2_98c37d69a244
  845ae603_b600_59de_a0ee_92d00c789425["isOutputShutdown()"]
  c458e276_eaf3_4567_04e0_b5864fe60240 -->|method| 845ae603_b600_59de_a0ee_92d00c789425
  c3d69935_1431_0429_50a7_0e27a88eb759["isInputShutdown()"]
  c458e276_eaf3_4567_04e0_b5864fe60240 -->|method| c3d69935_1431_0429_50a7_0e27a88eb759
  01529371_1609_98ef_869b_ae3872da435f["isShutdown()"]
  c458e276_eaf3_4567_04e0_b5864fe60240 -->|method| 01529371_1609_98ef_869b_ae3872da435f
  12da7908_f1bb_5a0b_6b45_7d90646c61c0["doShutdownOutput()"]
  c458e276_eaf3_4567_04e0_b5864fe60240 -->|method| 12da7908_f1bb_5a0b_6b45_7d90646c61c0
  429f5201_a59d_0cfa_6e70_d3ad852141c1["ChannelFuture()"]
  c458e276_eaf3_4567_04e0_b5864fe60240 -->|method| 429f5201_a59d_0cfa_6e70_d3ad852141c1
  a2a16610_05d5_ca06_33fb_3495a36c5e7f["doReadBytes()"]
  c458e276_eaf3_4567_04e0_b5864fe60240 -->|method| a2a16610_05d5_ca06_33fb_3495a36c5e7f
  e111a200_0933_12f7_8376_e6f1638528df["shutdownOutput0()"]
  c458e276_eaf3_4567_04e0_b5864fe60240 -->|method| e111a200_0933_12f7_8376_e6f1638528df
  99360243_5023_89c7_0532_862c3f09f581["shutdownInput0()"]
  c458e276_eaf3_4567_04e0_b5864fe60240 -->|method| 99360243_5023_89c7_0532_862c3f09f581

Relationship Graph

Source Code

transport/src/main/java/io/netty/channel/socket/oio/OioSocketChannel.java lines 44–350

@Deprecated
public class OioSocketChannel extends OioByteStreamChannel implements SocketChannel {

    private static final InternalLogger logger = InternalLoggerFactory.getInstance(OioSocketChannel.class);

    private final Socket socket;
    private final OioSocketChannelConfig config;

    /**
     * Create a new instance with an new {@link Socket}
     */
    public OioSocketChannel() {
        this(new Socket());
    }

    /**
     * Create a new instance from the given {@link Socket}
     *
     * @param socket    the {@link Socket} which is used by this instance
     */
    public OioSocketChannel(Socket socket) {
        this(null, socket);
    }

    /**
     * Create a new instance from the given {@link Socket}
     *
     * @param parent    the parent {@link Channel} which was used to create this instance. This can be null if the
     *                  {@link} has no parent as it was created by your self.
     * @param socket    the {@link Socket} which is used by this instance
     */
    public OioSocketChannel(Channel parent, Socket socket) {
        super(parent);
        this.socket = socket;
        config = new DefaultOioSocketChannelConfig(this, socket);

        boolean success = false;
        try {
            if (socket.isConnected()) {
                activate(socket.getInputStream(), socket.getOutputStream());
            }
            socket.setSoTimeout(SO_TIMEOUT);
            success = true;
        } catch (Exception e) {
            throw new ChannelException("failed to initialize a socket", e);
        } finally {
            if (!success) {
                try {
                    socket.close();
                } catch (IOException e) {
                    logger.warn("Failed to close a socket.", e);
                }
            }
        }
    }

    @Override
    public ServerSocketChannel parent() {
        return (ServerSocketChannel) super.parent();
    }

    @Override
    public OioSocketChannelConfig config() {
        return config;
    }

    @Override
    public boolean isOpen() {
        return !socket.isClosed();
    }

    @Override
    public boolean isActive() {
        return !socket.isClosed() && socket.isConnected();
    }

    @Override
    public boolean isOutputShutdown() {
        return socket.isOutputShutdown() || !isActive();
    }

Frequently Asked Questions

What is the OioSocketChannel class?
OioSocketChannel is a class in the netty codebase, defined in transport/src/main/java/io/netty/channel/socket/oio/OioSocketChannel.java.
Where is OioSocketChannel defined?
OioSocketChannel is defined in transport/src/main/java/io/netty/channel/socket/oio/OioSocketChannel.java at line 44.

Analyze Your Own Codebase

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

Try Supermodel Free