channel.getConfig().getReceiveBufferSizePredictor(); final int predictedRecvBufSize = predictor.nextReceiveBufferSize(); final ChannelBufferFactory bufferFactory = channel.getConfig().getBufferFactory();
public void run() { int timeout = channel.getConfig().getConnectTimeoutMillis(); if (timeout > 0) { if (!channel.isConnected()) { channel.timoutTimer = timer.newTimeout(wakeupTask, timeout, TimeUnit.MILLISECONDS); } } try { channel.channel.register( boss.selector, SelectionKey.OP_CONNECT, channel); } catch (ClosedChannelException e) { channel.worker.close(channel, succeededFuture(channel)); } int connectTimeout = channel.getConfig().getConnectTimeoutMillis(); if (connectTimeout > 0) { channel.connectDeadlineNanos = System.nanoTime() + connectTimeout * 1000000L; } } }
@Inject public NettyClientConfigBuilder() { // Thrift turns TCP_NODELAY by default, and turning it off can have latency implications // so let's turn it on by default as well. It can still be switched off by explicitly // calling setTcpNodelay(false) after construction. getSocketChannelConfig().setTcpNoDelay(true); }
/** * Set the max size for the write queue, see {@link WriteStream#setWriteQueueMaxSize} */ public void setWriteQueueMaxSize(int size) { NioSocketChannelConfig conf = (NioSocketChannelConfig) channel.getConfig(); conf.setWriteBufferLowWaterMark(size / 2); conf.setWriteBufferHighWaterMark(size); }
@Override protected final void doSetAll(IoSessionConfigEx config) { super.doSetAll(config); if (config instanceof NioSocketChannelIoSessionConfig) { channelConfig.setReceiveBufferSizePredictorFactory( ((NioSocketChannelIoSessionConfig) config).channelConfig.getReceiveBufferSizePredictorFactory()); } } }
public DefaultNioSocketChannelIoSessionConfig() { super(new DefaultNioSocketChannelConfig(new Socket())); // We could make this conditional (if !ENABLE_BUFFER_SIZE) to allow users to turn on variable buffer size via // the System property (as we used to in pure Mina days), but we won't because it would break zero copy and // is known to break TrafficShapingFilter so we don't want anyone ever to use it. channelConfig.setReceiveBufferSizePredictorFactory( new FixedReceiveBufferSizePredictorFactory(getReadBufferSize())); }
@Inject public NettyServerConfigBuilder() { // Thrift turns TCP_NODELAY by default, and turning it off can have latency implications // so let's turn it on by default as well. It can still be switched off by explicitly // calling setTcpNodelay(false) after construction. getSocketChannelConfig().setTcpNoDelay(true); }
channel.getConfig().getReceiveBufferSizePredictor(); final int predictedRecvBufSize = predictor.nextReceiveBufferSize(); final ChannelBufferFactory bufferFactory = channel.getConfig().getBufferFactory();
public void run() { int timeout = channel.getConfig().getConnectTimeoutMillis(); if (timeout > 0) { if (!channel.isConnected()) { channel.timoutTimer = timer.newTimeout(wakeupTask, timeout, TimeUnit.MILLISECONDS); } } try { channel.channel.register( boss.selector, SelectionKey.OP_CONNECT, channel); } catch (ClosedChannelException e) { channel.worker.close(channel, succeededFuture(channel)); } int connectTimeout = channel.getConfig().getConnectTimeoutMillis(); if (connectTimeout > 0) { channel.connectDeadlineNanos = System.nanoTime() + connectTimeout * 1000000L; } } }
private boolean readTcp(SelectionKey k, NioSocketChannel channel) { final SocketChannel ch = (SocketChannel) k.channel(); final ReceiveBufferSizePredictor predictor = channel.getConfig().getReceiveBufferSizePredictor(); final int predictedRecvBufSize = predictor.nextReceiveBufferSize(); final ChannelBufferFactory bufferFactory = channel.getConfig().getBufferFactory();