List of usage examples for io.netty.channel ChannelConfig getWriteBufferHighWaterMark
int getWriteBufferHighWaterMark();
From source file:io.advantageous.conekt.net.impl.ConnectionBase.java
License:Open Source License
public void doSetWriteQueueMaxSize(int size) { ChannelConfig config = channel.config(); int high = config.getWriteBufferHighWaterMark(); int newLow = size / 2; int newHigh = size; if (newLow >= high) { config.setWriteBufferHighWaterMark(newHigh); config.setWriteBufferLowWaterMark(newLow); } else {//w w w . j a v a 2 s. c o m config.setWriteBufferLowWaterMark(newLow); config.setWriteBufferHighWaterMark(newHigh); } }
From source file:org.jupiter.transport.netty.handler.acceptor.AcceptorHandler.java
License:Apache License
@Override public void channelWritabilityChanged(ChannelHandlerContext ctx) throws Exception { Channel ch = ctx.channel();/*from ww w .j a v a 2 s. co m*/ ChannelConfig config = ch.config(); // ?: ChannelOption.WRITE_BUFFER_HIGH_WATER_MARK // ?: ChannelOption.WRITE_BUFFER_LOW_WATER_MARK if (!ch.isWritable()) { // ?channel(OutboundBuffer)?WRITE_BUFFER_HIGH_WATER_MARK if (logger.isWarnEnabled()) { logger.warn( "{} is not writable, high water mask: {}, the number of flushed entries that are not written yet: {}.", ch, config.getWriteBufferHighWaterMark(), ch.unsafe().outboundBuffer().size()); } config.setAutoRead(false); } else { // ??OutboundBuffer?WRITE_BUFFER_LOW_WATER_MARK if (logger.isWarnEnabled()) { logger.warn( "{} is writable(rehabilitate), low water mask: {}, the number of flushed entries that are not written yet: {}.", ch, config.getWriteBufferLowWaterMark(), ch.unsafe().outboundBuffer().size()); } config.setAutoRead(true); } }