Interface DuplexChannelConfig
- All Superinterfaces:
ChannelConfig
- All Known Subinterfaces:
OioSocketChannelConfig, SocketChannelConfig
- All Known Implementing Classes:
DefaultOioSocketChannelConfig, DefaultSocketChannelConfig, EpollDomainSocketChannelConfig, EpollSocketChannelConfig, KQueueDomainSocketChannelConfig, KQueueSocketChannelConfig
A
ChannelConfig for a DuplexChannel.
Available options
In addition to the options provided byChannelConfig,
DuplexChannelConfig allows the following options in the option map:
ChannelOption.ALLOW_HALF_CLOSURE | setAllowHalfClosure(boolean) |
-
Method Summary
Modifier and TypeMethodDescriptionbooleanReturnstrueif and only if the channel should not close itself when its remote peer shuts down output to make the connection half-closed.setAllocator(ByteBufAllocator allocator) Set theByteBufAllocatorwhich is used for the channel to allocate buffers.setAllowHalfClosure(boolean allowHalfClosure) Sets whether the channel should not close itself when its remote peer shuts down output to make the connection half-closed.setAutoClose(boolean autoClose) Sets whether theChannelshould be closed automatically and immediately on write failure.setAutoRead(boolean autoRead) Sets ifChannelHandlerContext.read()will be invoked automatically so that a user application doesn't need to call it at all.setMaxMessagesPerRead(int maxMessagesPerRead) Deprecated.setMessageSizeEstimator(MessageSizeEstimator estimator) Set theMessageSizeEstimatorwhich is used for the channel to detect the size of a message.setRecvByteBufAllocator(RecvByteBufAllocator allocator) Set theRecvByteBufAllocatorwhich is used for the channel to allocate receive buffers.setWriteBufferWaterMark(WriteBufferWaterMark writeBufferWaterMark) Set theWriteBufferWaterMarkwhich is used for setting the high and low water mark of the write buffer.setWriteSpinCount(int writeSpinCount) Sets the maximum loop count for a write operation untilWritableByteChannel.write(ByteBuffer)returns a non-zero value.Methods inherited from interface ChannelConfig
getAllocator, getConnectTimeoutMillis, getMaxMessagesPerRead, getMessageSizeEstimator, getOption, getOptions, getRecvByteBufAllocator, getWriteBufferHighWaterMark, getWriteBufferLowWaterMark, getWriteBufferWaterMark, getWriteSpinCount, isAutoClose, isAutoRead, setConnectTimeoutMillis, setOption, setOptions, setWriteBufferHighWaterMark, setWriteBufferLowWaterMarkModifier and TypeMethodDescriptionReturnsByteBufAllocatorwhich is used for the channel to allocate buffers.intReturns the connect timeout of the channel in milliseconds.intDeprecated.ReturnsMessageSizeEstimatorwhich is used for the channel to detect the size of a message.<T> TgetOption(ChannelOption<T> option) Return the value of the givenChannelOptionMap<ChannelOption<?>, Object> Return all setChannelOption's.<T extends RecvByteBufAllocator>
TReturnsRecvByteBufAllocatorwhich is used for the channel to allocate receive buffers.intReturns the high water mark of the write buffer.intReturns the low water mark of the write buffer.Returns theWriteBufferWaterMarkwhich is used for setting the high and low water mark of the write buffer.intReturns the maximum loop count for a write operation untilWritableByteChannel.write(ByteBuffer)returns a non-zero value.booleanReturnstrueif and only if theChannelwill be closed automatically and immediately on write failure.booleanReturnstrueif and only ifChannelHandlerContext.read()will be invoked automatically so that a user application doesn't need to call it at all.setConnectTimeoutMillis(int connectTimeoutMillis) Sets the connect timeout of the channel in milliseconds.<T> booleansetOption(ChannelOption<T> option, T value) Sets a configuration property with the specified name and value.booleansetOptions(Map<ChannelOption<?>, ?> options) Sets the configuration properties from the specifiedMap.setWriteBufferHighWaterMark(int writeBufferHighWaterMark) Sets the high water mark of the write buffer.setWriteBufferLowWaterMark(int writeBufferLowWaterMark) Sets the low water mark of the write buffer.
-
Method Details
-
isAllowHalfClosure
boolean isAllowHalfClosure()Returnstrueif and only if the channel should not close itself when its remote peer shuts down output to make the connection half-closed. Iffalse, the connection is closed automatically when the remote peer shuts down output. -
setAllowHalfClosure
Sets whether the channel should not close itself when its remote peer shuts down output to make the connection half-closed. Iftruethe connection is not closed when the remote peer shuts down output. Instead,ChannelInboundHandler.userEventTriggered(ChannelHandlerContext, Object)is invoked with aChannelInputShutdownEventobject. Iffalse, the connection is closed automatically. -
setMaxMessagesPerRead
Deprecated.- Specified by:
setMaxMessagesPerReadin interfaceChannelConfig
-
setWriteSpinCount
Description copied from interface:ChannelConfigSets the maximum loop count for a write operation untilWritableByteChannel.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 is16.- Specified by:
setWriteSpinCountin interfaceChannelConfig
-
setAllocator
Description copied from interface:ChannelConfigSet theByteBufAllocatorwhich is used for the channel to allocate buffers.- Specified by:
setAllocatorin interfaceChannelConfig
-
setRecvByteBufAllocator
Description copied from interface:ChannelConfigSet theRecvByteBufAllocatorwhich is used for the channel to allocate receive buffers.- Specified by:
setRecvByteBufAllocatorin interfaceChannelConfig
-
setAutoRead
Description copied from interface:ChannelConfigSets ifChannelHandlerContext.read()will be invoked automatically so that a user application doesn't need to call it at all. The default value istrue.- Specified by:
setAutoReadin interfaceChannelConfig
-
setAutoClose
Description copied from interface:ChannelConfigSets whether theChannelshould be closed automatically and immediately on write failure. The default istrue.- Specified by:
setAutoClosein interfaceChannelConfig
-
setMessageSizeEstimator
Description copied from interface:ChannelConfigSet theMessageSizeEstimatorwhich is used for the channel to detect the size of a message.- Specified by:
setMessageSizeEstimatorin interfaceChannelConfig
-
setWriteBufferWaterMark
Description copied from interface:ChannelConfigSet theWriteBufferWaterMarkwhich is used for setting the high and low water mark of the write buffer.- Specified by:
setWriteBufferWaterMarkin interfaceChannelConfig
-
MaxMessagesRecvByteBufAllocatorandMaxMessagesRecvByteBufAllocator.maxMessagesPerRead().