[#1692] Allow to set WRITE_BUFFER_HIGH_WATER_MARK and WRITE_BUFFER_LOW_WATER_MARK via ChannelOption

This commit is contained in:
Norman Maurer 2013-08-08 20:30:01 +02:00
parent 1d3560e389
commit f40a3f34b1

View File

@ -68,7 +68,8 @@ public class DefaultChannelConfig implements ChannelConfig {
return getOptions(
null,
CONNECT_TIMEOUT_MILLIS, MAX_MESSAGES_PER_READ, WRITE_SPIN_COUNT,
ALLOCATOR, AUTO_READ, RCVBUF_ALLOCATOR);
ALLOCATOR, AUTO_READ, RCVBUF_ALLOCATOR, WRITE_BUFFER_HIGH_WATER_MARK,
WRITE_BUFFER_LOW_WATER_MARK);
}
protected Map<ChannelOption<?>, Object> getOptions(
@ -124,6 +125,12 @@ public class DefaultChannelConfig implements ChannelConfig {
if (option == AUTO_READ) {
return (T) Boolean.valueOf(isAutoRead());
}
if (option == WRITE_BUFFER_HIGH_WATER_MARK) {
return (T) Integer.valueOf(getWriteBufferHighWaterMark());
}
if (option == WRITE_BUFFER_LOW_WATER_MARK) {
return (T) Integer.valueOf(getWriteBufferLowWaterMark());
}
return null;
}
@ -144,6 +151,10 @@ public class DefaultChannelConfig implements ChannelConfig {
setRecvByteBufAllocator((RecvByteBufAllocator) value);
} else if (option == AUTO_READ) {
setAutoRead((Boolean) value);
} else if (option == WRITE_BUFFER_HIGH_WATER_MARK) {
setWriteBufferHighWaterMark((Integer) value);
} else if (option == WRITE_BUFFER_LOW_WATER_MARK) {
setWriteBufferLowWaterMark((Integer) value);
} else {
return false;
}