public class DefaultChannelConfig extends java.lang.Object implements ChannelConfig
ChannelConfig
implementation.限定符 | 构造器和说明 |
---|---|
|
DefaultChannelConfig(Channel channel) |
protected |
DefaultChannelConfig(Channel channel,
RecvByteBufAllocator allocator) |
限定符和类型 | 方法和说明 |
---|---|
protected void |
autoReadCleared()
|
ByteBufAllocator |
getAllocator()
Returns
ByteBufAllocator which is used for the channel
to allocate buffers. |
int |
getConnectTimeoutMillis()
Returns the connect timeout of the channel in milliseconds.
|
int |
getMaxMessagesPerRead()
已过时。
|
int |
getMaxMessagesPerWrite()
Get the maximum number of message to write per eventloop run.
|
MessageSizeEstimator |
getMessageSizeEstimator()
Returns
MessageSizeEstimator which is used for the channel
to detect the size of a message. |
<T> T |
getOption(ChannelOption<T> option)
Return the value of the given
ChannelOption |
java.util.Map<ChannelOption<?>,java.lang.Object> |
getOptions()
Return all set
ChannelOption 's. |
protected java.util.Map<ChannelOption<?>,java.lang.Object> |
getOptions(java.util.Map<ChannelOption<?>,java.lang.Object> result,
ChannelOption<?>... options) |
<T extends RecvByteBufAllocator> |
getRecvByteBufAllocator()
Returns
RecvByteBufAllocator which is used for the channel to allocate receive buffers. |
int |
getWriteBufferHighWaterMark()
Returns the high water mark of the write buffer.
|
int |
getWriteBufferLowWaterMark()
Returns the low water mark of the write buffer.
|
WriteBufferWaterMark |
getWriteBufferWaterMark()
Returns the
WriteBufferWaterMark which is used for setting the high and low
water mark of the write buffer. |
int |
getWriteSpinCount()
Returns the maximum loop count for a write operation until
WritableByteChannel.write(ByteBuffer) returns a non-zero value. |
boolean |
isAutoClose()
Returns
true if and only if the Channel will be closed automatically and immediately on
write failure. |
boolean |
isAutoRead()
Returns
true if and only if ChannelHandlerContext.read() will be invoked automatically so that
a user application doesn't need to call it at all. |
ChannelConfig |
setAllocator(ByteBufAllocator allocator)
Set the
ByteBufAllocator which is used for the channel
to allocate buffers. |
ChannelConfig |
setAutoClose(boolean autoClose)
Sets whether the
Channel should be closed automatically and immediately on write failure. |
ChannelConfig |
setAutoRead(boolean autoRead)
Sets if
ChannelHandlerContext.read() will be invoked automatically so that a user application doesn't
need to call it at all. |
ChannelConfig |
setConnectTimeoutMillis(int connectTimeoutMillis)
Sets the connect timeout of the channel in milliseconds.
|
ChannelConfig |
setMaxMessagesPerRead(int maxMessagesPerRead)
已过时。
|
ChannelConfig |
setMaxMessagesPerWrite(int maxMessagesPerWrite)
Set the maximum number of message to write per eventloop run.
|
ChannelConfig |
setMessageSizeEstimator(MessageSizeEstimator estimator)
Set the
MessageSizeEstimator which is used for the channel
to detect the size of a message. |
<T> boolean |
setOption(ChannelOption<T> option,
T value)
Sets a configuration property with the specified name and value.
|
boolean |
setOptions(java.util.Map<ChannelOption<?>,?> options)
Sets the configuration properties from the specified
Map . |
ChannelConfig |
setRecvByteBufAllocator(RecvByteBufAllocator allocator)
Set the
RecvByteBufAllocator which is used for the channel to allocate receive buffers. |
ChannelConfig |
setWriteBufferHighWaterMark(int writeBufferHighWaterMark)
Sets the high water mark of the write buffer.
|
ChannelConfig |
setWriteBufferLowWaterMark(int writeBufferLowWaterMark)
Sets the low water mark of the write buffer.
|
ChannelConfig |
setWriteBufferWaterMark(WriteBufferWaterMark writeBufferWaterMark)
Set the
WriteBufferWaterMark which is used for setting the high and low
water mark of the write buffer. |
ChannelConfig |
setWriteSpinCount(int writeSpinCount)
Sets the maximum loop count for a write operation until
WritableByteChannel.write(ByteBuffer) returns a non-zero value. |
protected <T> void |
validate(ChannelOption<T> option,
T value) |
protected final Channel channel
public DefaultChannelConfig(Channel channel)
protected DefaultChannelConfig(Channel channel, RecvByteBufAllocator allocator)
public java.util.Map<ChannelOption<?>,java.lang.Object> getOptions()
ChannelConfig
ChannelOption
's.getOptions
在接口中 ChannelConfig
protected java.util.Map<ChannelOption<?>,java.lang.Object> getOptions(java.util.Map<ChannelOption<?>,java.lang.Object> result, ChannelOption<?>... options)
public boolean setOptions(java.util.Map<ChannelOption<?>,?> options)
ChannelConfig
Map
.setOptions
在接口中 ChannelConfig
public <T> T getOption(ChannelOption<T> option)
ChannelConfig
ChannelOption
getOption
在接口中 ChannelConfig
public <T> boolean setOption(ChannelOption<T> option, T value)
ChannelConfig
public boolean setOption(ChannelOption<T> option, T value) { if (super.setOption(option, value)) { return true; } if (option.equals(additionalOption)) { .... return true; } return false; }
setOption
在接口中 ChannelConfig
true
if and only if the property has been setprotected <T> void validate(ChannelOption<T> option, T value)
public int getConnectTimeoutMillis()
ChannelConfig
Channel
does not support connect operation, this property is not
used at all, and therefore will be ignored.getConnectTimeoutMillis
在接口中 ChannelConfig
0
if disabled.public ChannelConfig setConnectTimeoutMillis(int connectTimeoutMillis)
ChannelConfig
Channel
does not support connect operation, this property is not
used at all, and therefore will be ignored.setConnectTimeoutMillis
在接口中 ChannelConfig
connectTimeoutMillis
- the connect timeout in milliseconds.
0
to disable.@Deprecated public int getMaxMessagesPerRead()
getMaxMessagesPerRead
在接口中 ChannelConfig
java.lang.IllegalStateException
- if getRecvByteBufAllocator()
does not return an object of type
MaxMessagesRecvByteBufAllocator
.@Deprecated public ChannelConfig setMaxMessagesPerRead(int maxMessagesPerRead)
setMaxMessagesPerRead
在接口中 ChannelConfig
java.lang.IllegalStateException
- if getRecvByteBufAllocator()
does not return an object of type
MaxMessagesRecvByteBufAllocator
.public int getMaxMessagesPerWrite()
public ChannelConfig setMaxMessagesPerWrite(int maxMessagesPerWrite)
public int getWriteSpinCount()
ChannelConfig
WritableByteChannel.write(ByteBuffer)
returns a non-zero value.
It is similar to what a spin lock is used for in concurrency programming.
It improves memory utilization and write throughput depending on
the platform that JVM runs on. The default value is 16
.getWriteSpinCount
在接口中 ChannelConfig
public ChannelConfig setWriteSpinCount(int writeSpinCount)
ChannelConfig
WritableByteChannel.write(ByteBuffer)
returns a non-zero value.
It is similar to what a spin lock is used for in concurrency programming.
It improves memory utilization and write throughput depending on
the platform that JVM runs on. The default value is 16
.setWriteSpinCount
在接口中 ChannelConfig
public ByteBufAllocator getAllocator()
ChannelConfig
ByteBufAllocator
which is used for the channel
to allocate buffers.getAllocator
在接口中 ChannelConfig
public ChannelConfig setAllocator(ByteBufAllocator allocator)
ChannelConfig
ByteBufAllocator
which is used for the channel
to allocate buffers.setAllocator
在接口中 ChannelConfig
public <T extends RecvByteBufAllocator> T getRecvByteBufAllocator()
ChannelConfig
RecvByteBufAllocator
which is used for the channel to allocate receive buffers.getRecvByteBufAllocator
在接口中 ChannelConfig
public ChannelConfig setRecvByteBufAllocator(RecvByteBufAllocator allocator)
ChannelConfig
RecvByteBufAllocator
which is used for the channel to allocate receive buffers.setRecvByteBufAllocator
在接口中 ChannelConfig
public boolean isAutoRead()
ChannelConfig
true
if and only if ChannelHandlerContext.read()
will be invoked automatically so that
a user application doesn't need to call it at all. The default value is true
.isAutoRead
在接口中 ChannelConfig
public ChannelConfig setAutoRead(boolean autoRead)
ChannelConfig
ChannelHandlerContext.read()
will be invoked automatically so that a user application doesn't
need to call it at all. The default value is true
.setAutoRead
在接口中 ChannelConfig
protected void autoReadCleared()
public boolean isAutoClose()
ChannelConfig
true
if and only if the Channel
will be closed automatically and immediately on
write failure. The default is true
.isAutoClose
在接口中 ChannelConfig
public ChannelConfig setAutoClose(boolean autoClose)
ChannelConfig
Channel
should be closed automatically and immediately on write failure.
The default is true
.setAutoClose
在接口中 ChannelConfig
public int getWriteBufferHighWaterMark()
ChannelConfig
Channel.isWritable()
will start to return false
.getWriteBufferHighWaterMark
在接口中 ChannelConfig
public ChannelConfig setWriteBufferHighWaterMark(int writeBufferHighWaterMark)
ChannelConfig
Sets the high water mark of the write buffer. If the number of bytes
queued in the write buffer exceeds this value, Channel.isWritable()
will start to return false
.
setWriteBufferHighWaterMark
在接口中 ChannelConfig
public int getWriteBufferLowWaterMark()
ChannelConfig
Channel.isWritable()
will start to return
true
again.getWriteBufferLowWaterMark
在接口中 ChannelConfig
public ChannelConfig setWriteBufferLowWaterMark(int writeBufferLowWaterMark)
ChannelConfig
Sets the low water mark of the write buffer. Once the number of bytes
queued in the write buffer exceeded the
high water mark and then
dropped down below this value, Channel.isWritable()
will start to return
true
again.
setWriteBufferLowWaterMark
在接口中 ChannelConfig
public ChannelConfig setWriteBufferWaterMark(WriteBufferWaterMark writeBufferWaterMark)
ChannelConfig
WriteBufferWaterMark
which is used for setting the high and low
water mark of the write buffer.setWriteBufferWaterMark
在接口中 ChannelConfig
public WriteBufferWaterMark getWriteBufferWaterMark()
ChannelConfig
WriteBufferWaterMark
which is used for setting the high and low
water mark of the write buffer.getWriteBufferWaterMark
在接口中 ChannelConfig
public MessageSizeEstimator getMessageSizeEstimator()
ChannelConfig
MessageSizeEstimator
which is used for the channel
to detect the size of a message.getMessageSizeEstimator
在接口中 ChannelConfig
public ChannelConfig setMessageSizeEstimator(MessageSizeEstimator estimator)
ChannelConfig
MessageSizeEstimator
which is used for the channel
to detect the size of a message.setMessageSizeEstimator
在接口中 ChannelConfig