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());
}
}
Aggregations