Example usage for io.netty.channel ChannelConfig getWriteBufferLowWaterMark

List of usage examples for io.netty.channel ChannelConfig getWriteBufferLowWaterMark

Introduction

In this page you can find the example usage for io.netty.channel ChannelConfig getWriteBufferLowWaterMark.

Prototype

int getWriteBufferLowWaterMark();

Source Link

Document

Returns the low water mark of the write buffer.

Usage

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 w ww .  j  av  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);
    }
}