Search in sources :

Example 1 with ChannelConfig

use of org.jboss.netty.channel.ChannelConfig in project databus by linkedin.

the class ChunkedBodyWritableByteChannel method writeToChannel.

private void writeToChannel(Object o, int flushSize) throws IOException {
    ChannelFuture channelFuture = _channel.write(o);
    if (flushSize > 0 && !_channel.isWritable()) {
        ChannelConfig channelConfig = _channel.getConfig();
        if (channelConfig instanceof NioSocketChannelConfig) {
            NioSocketChannelConfig nioSocketConfig = (NioSocketChannelConfig) channelConfig;
            nioSocketConfig.setWriteBufferLowWaterMark(flushSize);
            nioSocketConfig.setWriteBufferHighWaterMark(flushSize);
        }
    }
    awaitChannelFuture(channelFuture);
    if (!channelFuture.isSuccess()) {
        throw new IOException(channelFuture.getCause());
    }
}
Also used : ChannelFuture(org.jboss.netty.channel.ChannelFuture) NioSocketChannelConfig(org.jboss.netty.channel.socket.nio.NioSocketChannelConfig) ChannelConfig(org.jboss.netty.channel.ChannelConfig) NioSocketChannelConfig(org.jboss.netty.channel.socket.nio.NioSocketChannelConfig) IOException(java.io.IOException)

Aggregations

IOException (java.io.IOException)1 ChannelConfig (org.jboss.netty.channel.ChannelConfig)1 ChannelFuture (org.jboss.netty.channel.ChannelFuture)1 NioSocketChannelConfig (org.jboss.netty.channel.socket.nio.NioSocketChannelConfig)1