Java 类io.netty.channel.sctp.DefaultSctpChannelConfig 实例源码

项目:netty4study    文件:NioSctpChannel.java   
/**
 * Create a new instance
 *
 * @param parent        the {@link Channel} which is the parent of this {@link NioSctpChannel}
 *                      or {@code null}.
 * @param sctpChannel   the underlying {@link SctpChannel}
 */
public NioSctpChannel(Channel parent, SctpChannel sctpChannel) {
    super(parent, sctpChannel, SelectionKey.OP_READ);
    try {
        sctpChannel.configureBlocking(false);
        config = new DefaultSctpChannelConfig(this, sctpChannel);
        notificationHandler = new SctpNotificationHandler(this);
    } catch (IOException e) {
        try {
            sctpChannel.close();
        } catch (IOException e2) {
            if (logger.isWarnEnabled()) {
                logger.warn(
                        "Failed to close a partially initialized sctp channel.", e2);
            }
        }

        throw new ChannelException("Failed to enter non-blocking mode.", e);
    }
}
项目:netty-netty-5.0.0.Alpha1    文件:NioSctpChannel.java   
/**
 * Create a new instance
 *
 * @param parent        the {@link Channel} which is the parent of this {@link NioSctpChannel}
 *                      or {@code null}.
 * @param sctpChannel   the underlying {@link SctpChannel}
 */
public NioSctpChannel(Channel parent, EventLoop eventLoop, SctpChannel sctpChannel) {
    super(parent, eventLoop, sctpChannel, SelectionKey.OP_READ);
    try {
        sctpChannel.configureBlocking(false);
        config = new DefaultSctpChannelConfig(this, sctpChannel);
        notificationHandler = new SctpNotificationHandler(this);
    } catch (IOException e) {
        try {
            sctpChannel.close();
        } catch (IOException e2) {
            if (logger.isWarnEnabled()) {
                logger.warn(
                        "Failed to close a partially initialized sctp channel.", e2);
            }
        }

        throw new ChannelException("Failed to enter non-blocking mode.", e);
    }
}