Java Code Examples for io.netty.util.internal.PlatformDependent#canEnableTcpNoDelayByDefault()

The following examples show how to use io.netty.util.internal.PlatformDependent#canEnableTcpNoDelayByDefault() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DefaultSocketChannelConfig.java    From netty-4.1.22 with Apache License 2.0 6 votes vote down vote up
/**
 * Creates a new instance.
 */
public DefaultSocketChannelConfig(SocketChannel channel, Socket javaSocket) {
    super(channel);
    if (javaSocket == null) {
        throw new NullPointerException("javaSocket");
    }
    this.javaSocket = javaSocket;

    // Enable TCP_NODELAY by default if possible.
    if (PlatformDependent.canEnableTcpNoDelayByDefault()) {
        try {
            setTcpNoDelay(true);
        } catch (Exception e) {
            // Ignore.
        }
    }
}
 
Example 2
Source File: DefaultSctpChannelConfig.java    From netty-4.1.22 with Apache License 2.0 6 votes vote down vote up
public DefaultSctpChannelConfig(io.netty.channel.sctp.SctpChannel channel, SctpChannel javaChannel) {
    super(channel);
    if (javaChannel == null) {
        throw new NullPointerException("javaChannel");
    }
    this.javaChannel = javaChannel;

    // Enable TCP_NODELAY by default if possible.
    if (PlatformDependent.canEnableTcpNoDelayByDefault()) {
        try {
            setSctpNoDelay(true);
        } catch (Exception e) {
            // Ignore.
        }
    }
}
 
Example 3
Source File: DefaultSocketChannelConfig.java    From netty4.0.27Learn with Apache License 2.0 6 votes vote down vote up
/**
 * Creates a new instance.
 */
public DefaultSocketChannelConfig(SocketChannel channel, Socket javaSocket) {
    super(channel);
    if (javaSocket == null) {
        throw new NullPointerException("javaSocket");
    }
    this.javaSocket = javaSocket;

    // Enable TCP_NODELAY by default if possible.
    if (PlatformDependent.canEnableTcpNoDelayByDefault()) {
        try {
            setTcpNoDelay(true);
        } catch (Exception e) {
            // Ignore.
        }
    }
}
 
Example 4
Source File: DefaultSctpChannelConfig.java    From netty4.0.27Learn with Apache License 2.0 6 votes vote down vote up
public DefaultSctpChannelConfig(io.netty.channel.sctp.SctpChannel channel, SctpChannel javaChannel) {
    super(channel);
    if (javaChannel == null) {
        throw new NullPointerException("javaChannel");
    }
    this.javaChannel = javaChannel;

    // Enable TCP_NODELAY by default if possible.
    if (PlatformDependent.canEnableTcpNoDelayByDefault()) {
        try {
            setSctpNoDelay(true);
        } catch (Exception e) {
            // Ignore.
        }
    }
}
 
Example 5
Source File: KQueueSocketChannelConfig.java    From netty-4.1.22 with Apache License 2.0 5 votes vote down vote up
KQueueSocketChannelConfig(KQueueSocketChannel channel) {
    super(channel);
    this.channel = channel;
    if (PlatformDependent.canEnableTcpNoDelayByDefault()) {
        setTcpNoDelay(true);
    }
    calculateMaxBytesPerGatheringWrite();
}
 
Example 6
Source File: EpollSocketChannelConfig.java    From netty-4.1.22 with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a new instance.
 */
EpollSocketChannelConfig(EpollSocketChannel channel) {
    super(channel);

    this.channel = channel;
    if (PlatformDependent.canEnableTcpNoDelayByDefault()) {
        setTcpNoDelay(true);
    }
    calculateMaxBytesPerGatheringWrite();
}
 
Example 7
Source File: EpollSocketChannelConfig.java    From netty4.0.27Learn with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a new instance.
 */
EpollSocketChannelConfig(EpollSocketChannel channel) {
    super(channel);

    this.channel = channel;
    if (PlatformDependent.canEnableTcpNoDelayByDefault()) {
        setTcpNoDelay(true);
    }
}