[#1711] Allow to use ChannelOption for set / get MessageSizeEstimator
This commit is contained in:
parent
f40a3f34b1
commit
b54937ab50
@ -39,6 +39,8 @@ public class ChannelOption<T> extends UniqueName {
|
||||
new ChannelOption<ByteBufAllocator>("ALLOCATOR");
|
||||
public static final ChannelOption<RecvByteBufAllocator> RCVBUF_ALLOCATOR =
|
||||
new ChannelOption<RecvByteBufAllocator>("RCVBUF_ALLOCATOR");
|
||||
public static final ChannelOption<MessageSizeEstimator> MESSAGE_SIZE_ESTIMATOR =
|
||||
new ChannelOption<MessageSizeEstimator>("MESSAGE_SIZE_ESTIMATOR");
|
||||
|
||||
public static final ChannelOption<Integer> CONNECT_TIMEOUT_MILLIS =
|
||||
new ChannelOption<Integer>("CONNECT_TIMEOUT_MILLIS");
|
||||
|
@ -69,7 +69,7 @@ public class DefaultChannelConfig implements ChannelConfig {
|
||||
null,
|
||||
CONNECT_TIMEOUT_MILLIS, MAX_MESSAGES_PER_READ, WRITE_SPIN_COUNT,
|
||||
ALLOCATOR, AUTO_READ, RCVBUF_ALLOCATOR, WRITE_BUFFER_HIGH_WATER_MARK,
|
||||
WRITE_BUFFER_LOW_WATER_MARK);
|
||||
WRITE_BUFFER_LOW_WATER_MARK, MESSAGE_SIZE_ESTIMATOR);
|
||||
}
|
||||
|
||||
protected Map<ChannelOption<?>, Object> getOptions(
|
||||
@ -131,7 +131,9 @@ public class DefaultChannelConfig implements ChannelConfig {
|
||||
if (option == WRITE_BUFFER_LOW_WATER_MARK) {
|
||||
return (T) Integer.valueOf(getWriteBufferLowWaterMark());
|
||||
}
|
||||
|
||||
if (option == MESSAGE_SIZE_ESTIMATOR) {
|
||||
return (T) getMessageSizeEstimator();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -155,6 +157,8 @@ public class DefaultChannelConfig implements ChannelConfig {
|
||||
setWriteBufferHighWaterMark((Integer) value);
|
||||
} else if (option == WRITE_BUFFER_LOW_WATER_MARK) {
|
||||
setWriteBufferLowWaterMark((Integer) value);
|
||||
} else if (option == MESSAGE_SIZE_ESTIMATOR) {
|
||||
setMessageSizeEstimator((MessageSizeEstimator) value);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user