Package io.netty.channel.uring
Class IoUringDatagramChannelConfig
- java.lang.Object
-
- io.netty.channel.DefaultChannelConfig
-
- io.netty.channel.uring.IoUringChannelConfig
-
- io.netty.channel.uring.IoUringDatagramChannelConfig
-
- All Implemented Interfaces:
ChannelConfig,DatagramChannelConfig
final class IoUringDatagramChannelConfig extends IoUringChannelConfig implements DatagramChannelConfig
-
-
Field Summary
Fields Modifier and Type Field Description private booleanactiveOnOpenprivate static RecvByteBufAllocatorDEFAULT_RCVBUF_ALLOCATORprivate intmaxDatagramSize-
Fields inherited from class io.netty.channel.DefaultChannelConfig
channel
-
-
Constructor Summary
Constructors Constructor Description IoUringDatagramChannelConfig(AbstractIoUringChannel channel)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description (package private) booleangetActiveOnOpen()java.net.InetAddressgetInterface()Gets the address of the network interface used for multicast packets.intgetMaxDatagramPayloadSize()Get the maximumDatagramPacketsize.java.net.NetworkInterfacegetNetworkInterface()Gets theStandardSocketOptions.IP_MULTICAST_IFoption.<T> TgetOption(ChannelOption<T> option)Return the value of the givenChannelOptionjava.util.Map<ChannelOption<?>,java.lang.Object>getOptions()Return all setChannelOption's.intgetReceiveBufferSize()Gets theStandardSocketOptions.SO_RCVBUFoption.intgetSendBufferSize()Gets theStandardSocketOptions.SO_SNDBUFoption.intgetTimeToLive()Gets theStandardSocketOptions.IP_MULTICAST_TTLoption.intgetTrafficClass()Gets theStandardSocketOptions.IP_TOSoption.booleanisBroadcast()Gets theStandardSocketOptions.SO_BROADCASToption.booleanisFreeBind()booleanisIpMulticastAll()booleanisIpTransparent()booleanisLoopbackModeDisabled()Gets theStandardSocketOptions.IP_MULTICAST_LOOPoption.booleanisReuseAddress()Gets theStandardSocketOptions.SO_REUSEADDRoption.booleanisReusePort()Returnstrueif the SO_REUSEPORT option is set.private voidsetActiveOnOpen(boolean activeOnOpen)IoUringDatagramChannelConfigsetAllocator(ByteBufAllocator allocator)Set theByteBufAllocatorwhich is used for the channel to allocate buffers.IoUringDatagramChannelConfigsetAutoClose(boolean autoClose)Sets whether theChannelshould be closed automatically and immediately on write failure.IoUringDatagramChannelConfigsetAutoRead(boolean autoRead)Sets ifChannelHandlerContext.read()will be invoked automatically so that a user application doesn't need to call it at all.IoUringDatagramChannelConfigsetBroadcast(boolean broadcast)Sets theStandardSocketOptions.SO_BROADCASToption.IoUringDatagramChannelConfigsetConnectTimeoutMillis(int connectTimeoutMillis)Sets the connect timeout of the channel in milliseconds.IoUringDatagramChannelConfigsetFreeBind(boolean freeBind)IoUringDatagramChannelConfigsetInterface(java.net.InetAddress interfaceAddress)Sets the address of the network interface used for multicast packets.IoUringDatagramChannelConfigsetIpMulticastAll(boolean multicastAll)IoUringDatagramChannelConfigsetIpTransparent(boolean ipTransparent)IoUringDatagramChannelConfigsetLoopbackModeDisabled(boolean loopbackModeDisabled)Sets theStandardSocketOptions.IP_MULTICAST_LOOPoption.IoUringDatagramChannelConfigsetMaxDatagramPayloadSize(int maxDatagramSize)Set the maximumDatagramPacketsize.IoUringDatagramChannelConfigsetMaxMessagesPerRead(int maxMessagesPerRead)Deprecated.IoUringDatagramChannelConfigsetMessageSizeEstimator(MessageSizeEstimator estimator)Set theMessageSizeEstimatorwhich is used for the channel to detect the size of a message.IoUringDatagramChannelConfigsetNetworkInterface(java.net.NetworkInterface networkInterface)Sets theStandardSocketOptions.IP_MULTICAST_IFoption.<T> booleansetOption(ChannelOption<T> option, T value)Sets a configuration property with the specified name and value.IoUringDatagramChannelConfigsetReceiveBufferSize(int receiveBufferSize)Sets theStandardSocketOptions.SO_RCVBUFoption.IoUringDatagramChannelConfigsetRecvByteBufAllocator(RecvByteBufAllocator allocator)Set theRecvByteBufAllocatorwhich is used for the channel to allocate receive buffers.IoUringDatagramChannelConfigsetReuseAddress(boolean reuseAddress)Gets theStandardSocketOptions.SO_REUSEADDRoption.IoUringDatagramChannelConfigsetReusePort(boolean reusePort)Set the SO_REUSEPORT option on the underlying Channel.IoUringDatagramChannelConfigsetSendBufferSize(int sendBufferSize)Sets theStandardSocketOptions.SO_SNDBUFoption.IoUringDatagramChannelConfigsetTimeToLive(int ttl)Sets theStandardSocketOptions.IP_MULTICAST_TTLoption.IoUringDatagramChannelConfigsetTrafficClass(int trafficClass)Sets theStandardSocketOptions.IP_TOSoption.IoUringDatagramChannelConfigsetWriteBufferHighWaterMark(int writeBufferHighWaterMark)Deprecated.IoUringDatagramChannelConfigsetWriteBufferLowWaterMark(int writeBufferLowWaterMark)Deprecated.IoUringDatagramChannelConfigsetWriteBufferWaterMark(WriteBufferWaterMark writeBufferWaterMark)Set theWriteBufferWaterMarkwhich is used for setting the high and low water mark of the write buffer.IoUringDatagramChannelConfigsetWriteSpinCount(int writeSpinCount)Sets the maximum loop count for a write operation untilWritableByteChannel.write(ByteBuffer)returns a non-zero value.-
Methods inherited from class io.netty.channel.uring.IoUringChannelConfig
autoReadCleared, setMaxMessagesPerWrite
-
Methods inherited from class io.netty.channel.DefaultChannelConfig
getAllocator, getConnectTimeoutMillis, getMaxMessagesPerRead, getMaxMessagesPerWrite, getMessageSizeEstimator, getOptions, getRecvByteBufAllocator, getWriteBufferHighWaterMark, getWriteBufferLowWaterMark, getWriteBufferWaterMark, getWriteSpinCount, isAutoClose, isAutoRead, setOptions, validate
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.netty.channel.ChannelConfig
getAllocator, getConnectTimeoutMillis, getMaxMessagesPerRead, getMessageSizeEstimator, getRecvByteBufAllocator, getWriteBufferHighWaterMark, getWriteBufferLowWaterMark, getWriteBufferWaterMark, getWriteSpinCount, isAutoClose, isAutoRead, setOptions
-
-
-
-
Field Detail
-
DEFAULT_RCVBUF_ALLOCATOR
private static final RecvByteBufAllocator DEFAULT_RCVBUF_ALLOCATOR
-
activeOnOpen
private boolean activeOnOpen
-
maxDatagramSize
private volatile int maxDatagramSize
-
-
Constructor Detail
-
IoUringDatagramChannelConfig
IoUringDatagramChannelConfig(AbstractIoUringChannel channel)
-
-
Method Detail
-
getOptions
public java.util.Map<ChannelOption<?>,java.lang.Object> getOptions()
Description copied from interface:ChannelConfigReturn all setChannelOption's.- Specified by:
getOptionsin interfaceChannelConfig- Overrides:
getOptionsin classDefaultChannelConfig
-
getOption
public <T> T getOption(ChannelOption<T> option)
Description copied from interface:ChannelConfigReturn the value of the givenChannelOption- Specified by:
getOptionin interfaceChannelConfig- Overrides:
getOptionin classIoUringChannelConfig
-
setOption
public <T> boolean setOption(ChannelOption<T> option, T value)
Description copied from interface:ChannelConfigSets a configuration property with the specified name and value. To override this method properly, you must call the super class:public boolean setOption(ChannelOption<T> option, T value) { if (super.setOption(option, value)) { return true; } if (option.equals(additionalOption)) { .... return true; } return false; }- Specified by:
setOptionin interfaceChannelConfig- Overrides:
setOptionin classIoUringChannelConfig- Returns:
trueif and only if the property has been set
-
setActiveOnOpen
private void setActiveOnOpen(boolean activeOnOpen)
-
getActiveOnOpen
boolean getActiveOnOpen()
-
setMessageSizeEstimator
public IoUringDatagramChannelConfig setMessageSizeEstimator(MessageSizeEstimator estimator)
Description copied from interface:ChannelConfigSet theMessageSizeEstimatorwhich is used for the channel to detect the size of a message.- Specified by:
setMessageSizeEstimatorin interfaceChannelConfig- Specified by:
setMessageSizeEstimatorin interfaceDatagramChannelConfig- Overrides:
setMessageSizeEstimatorin classIoUringChannelConfig
-
setWriteBufferLowWaterMark
@Deprecated public IoUringDatagramChannelConfig setWriteBufferLowWaterMark(int writeBufferLowWaterMark)
Deprecated.Description copied from interface:ChannelConfigSets 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 returntrueagain.- Specified by:
setWriteBufferLowWaterMarkin interfaceChannelConfig- Overrides:
setWriteBufferLowWaterMarkin classIoUringChannelConfig
-
setWriteBufferHighWaterMark
@Deprecated public IoUringDatagramChannelConfig setWriteBufferHighWaterMark(int writeBufferHighWaterMark)
Deprecated.Description copied from interface:ChannelConfigSets 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 returnfalse.- Specified by:
setWriteBufferHighWaterMarkin interfaceChannelConfig- Overrides:
setWriteBufferHighWaterMarkin classIoUringChannelConfig
-
setWriteBufferWaterMark
public IoUringDatagramChannelConfig setWriteBufferWaterMark(WriteBufferWaterMark writeBufferWaterMark)
Description copied from interface:ChannelConfigSet theWriteBufferWaterMarkwhich is used for setting the high and low water mark of the write buffer.- Specified by:
setWriteBufferWaterMarkin interfaceChannelConfig- Specified by:
setWriteBufferWaterMarkin interfaceDatagramChannelConfig- Overrides:
setWriteBufferWaterMarkin classIoUringChannelConfig
-
setAutoClose
public IoUringDatagramChannelConfig setAutoClose(boolean autoClose)
Description copied from interface:ChannelConfigSets whether theChannelshould be closed automatically and immediately on write failure. The default istrue.- Specified by:
setAutoClosein interfaceChannelConfig- Specified by:
setAutoClosein interfaceDatagramChannelConfig- Overrides:
setAutoClosein classIoUringChannelConfig
-
setAutoRead
public IoUringDatagramChannelConfig setAutoRead(boolean autoRead)
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- Specified by:
setAutoReadin interfaceDatagramChannelConfig- Overrides:
setAutoReadin classIoUringChannelConfig
-
setRecvByteBufAllocator
public IoUringDatagramChannelConfig setRecvByteBufAllocator(RecvByteBufAllocator allocator)
Description copied from interface:ChannelConfigSet theRecvByteBufAllocatorwhich is used for the channel to allocate receive buffers.- Specified by:
setRecvByteBufAllocatorin interfaceChannelConfig- Specified by:
setRecvByteBufAllocatorin interfaceDatagramChannelConfig- Overrides:
setRecvByteBufAllocatorin classIoUringChannelConfig
-
setWriteSpinCount
public IoUringDatagramChannelConfig setWriteSpinCount(int writeSpinCount)
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- Specified by:
setWriteSpinCountin interfaceDatagramChannelConfig- Overrides:
setWriteSpinCountin classIoUringChannelConfig
-
setAllocator
public IoUringDatagramChannelConfig setAllocator(ByteBufAllocator allocator)
Description copied from interface:ChannelConfigSet theByteBufAllocatorwhich is used for the channel to allocate buffers.- Specified by:
setAllocatorin interfaceChannelConfig- Specified by:
setAllocatorin interfaceDatagramChannelConfig- Overrides:
setAllocatorin classIoUringChannelConfig
-
setConnectTimeoutMillis
public IoUringDatagramChannelConfig setConnectTimeoutMillis(int connectTimeoutMillis)
Description copied from interface:ChannelConfigSets the connect timeout of the channel in milliseconds. If theChanneldoes not support connect operation, this property is not used at all, and therefore will be ignored.- Specified by:
setConnectTimeoutMillisin interfaceChannelConfig- Specified by:
setConnectTimeoutMillisin interfaceDatagramChannelConfig- Overrides:
setConnectTimeoutMillisin classIoUringChannelConfig- Parameters:
connectTimeoutMillis- the connect timeout in milliseconds.0to disable.
-
setMaxMessagesPerRead
@Deprecated public IoUringDatagramChannelConfig setMaxMessagesPerRead(int maxMessagesPerRead)
Deprecated.Description copied from class:DefaultChannelConfig- Specified by:
setMaxMessagesPerReadin interfaceChannelConfig- Specified by:
setMaxMessagesPerReadin interfaceDatagramChannelConfig- Overrides:
setMaxMessagesPerReadin classIoUringChannelConfig
-
getSendBufferSize
public int getSendBufferSize()
Description copied from interface:DatagramChannelConfigGets theStandardSocketOptions.SO_SNDBUFoption.- Specified by:
getSendBufferSizein interfaceDatagramChannelConfig
-
setSendBufferSize
public IoUringDatagramChannelConfig setSendBufferSize(int sendBufferSize)
Description copied from interface:DatagramChannelConfigSets theStandardSocketOptions.SO_SNDBUFoption.- Specified by:
setSendBufferSizein interfaceDatagramChannelConfig
-
getReceiveBufferSize
public int getReceiveBufferSize()
Description copied from interface:DatagramChannelConfigGets theStandardSocketOptions.SO_RCVBUFoption.- Specified by:
getReceiveBufferSizein interfaceDatagramChannelConfig
-
setReceiveBufferSize
public IoUringDatagramChannelConfig setReceiveBufferSize(int receiveBufferSize)
Description copied from interface:DatagramChannelConfigSets theStandardSocketOptions.SO_RCVBUFoption.- Specified by:
setReceiveBufferSizein interfaceDatagramChannelConfig
-
getTrafficClass
public int getTrafficClass()
Description copied from interface:DatagramChannelConfigGets theStandardSocketOptions.IP_TOSoption.- Specified by:
getTrafficClassin interfaceDatagramChannelConfig
-
setTrafficClass
public IoUringDatagramChannelConfig setTrafficClass(int trafficClass)
Description copied from interface:DatagramChannelConfigSets theStandardSocketOptions.IP_TOSoption.- Specified by:
setTrafficClassin interfaceDatagramChannelConfig
-
isReuseAddress
public boolean isReuseAddress()
Description copied from interface:DatagramChannelConfigGets theStandardSocketOptions.SO_REUSEADDRoption.- Specified by:
isReuseAddressin interfaceDatagramChannelConfig
-
setReuseAddress
public IoUringDatagramChannelConfig setReuseAddress(boolean reuseAddress)
Description copied from interface:DatagramChannelConfigGets theStandardSocketOptions.SO_REUSEADDRoption.- Specified by:
setReuseAddressin interfaceDatagramChannelConfig
-
isBroadcast
public boolean isBroadcast()
Description copied from interface:DatagramChannelConfigGets theStandardSocketOptions.SO_BROADCASToption.- Specified by:
isBroadcastin interfaceDatagramChannelConfig
-
setBroadcast
public IoUringDatagramChannelConfig setBroadcast(boolean broadcast)
Description copied from interface:DatagramChannelConfigSets theStandardSocketOptions.SO_BROADCASToption.- Specified by:
setBroadcastin interfaceDatagramChannelConfig
-
isLoopbackModeDisabled
public boolean isLoopbackModeDisabled()
Description copied from interface:DatagramChannelConfigGets theStandardSocketOptions.IP_MULTICAST_LOOPoption.- Specified by:
isLoopbackModeDisabledin interfaceDatagramChannelConfig- Returns:
trueif and only if the loopback mode has been disabled
-
setLoopbackModeDisabled
public IoUringDatagramChannelConfig setLoopbackModeDisabled(boolean loopbackModeDisabled)
Description copied from interface:DatagramChannelConfigSets theStandardSocketOptions.IP_MULTICAST_LOOPoption.- Specified by:
setLoopbackModeDisabledin interfaceDatagramChannelConfig- Parameters:
loopbackModeDisabled-trueif and only if the loopback mode has been disabled
-
getTimeToLive
public int getTimeToLive()
Description copied from interface:DatagramChannelConfigGets theStandardSocketOptions.IP_MULTICAST_TTLoption.- Specified by:
getTimeToLivein interfaceDatagramChannelConfig
-
setTimeToLive
public IoUringDatagramChannelConfig setTimeToLive(int ttl)
Description copied from interface:DatagramChannelConfigSets theStandardSocketOptions.IP_MULTICAST_TTLoption.- Specified by:
setTimeToLivein interfaceDatagramChannelConfig
-
getInterface
public java.net.InetAddress getInterface()
Description copied from interface:DatagramChannelConfigGets the address of the network interface used for multicast packets.- Specified by:
getInterfacein interfaceDatagramChannelConfig
-
setInterface
public IoUringDatagramChannelConfig setInterface(java.net.InetAddress interfaceAddress)
Description copied from interface:DatagramChannelConfigSets the address of the network interface used for multicast packets.- Specified by:
setInterfacein interfaceDatagramChannelConfig
-
getNetworkInterface
public java.net.NetworkInterface getNetworkInterface()
Description copied from interface:DatagramChannelConfigGets theStandardSocketOptions.IP_MULTICAST_IFoption.- Specified by:
getNetworkInterfacein interfaceDatagramChannelConfig
-
setNetworkInterface
public IoUringDatagramChannelConfig setNetworkInterface(java.net.NetworkInterface networkInterface)
Description copied from interface:DatagramChannelConfigSets theStandardSocketOptions.IP_MULTICAST_IFoption.- Specified by:
setNetworkInterfacein interfaceDatagramChannelConfig
-
isReusePort
public boolean isReusePort()
Returnstrueif the SO_REUSEPORT option is set.
-
setReusePort
public IoUringDatagramChannelConfig setReusePort(boolean reusePort)
Set the SO_REUSEPORT option on the underlying Channel. This will allow to bind multipleDatagramChannels to the same port and so receive datagrams with multiple threads. Be aware this method needs be called beforeChannel.bind(java.net.SocketAddress)to have any affect.
-
isIpTransparent
public boolean isIpTransparent()
-
setIpTransparent
public IoUringDatagramChannelConfig setIpTransparent(boolean ipTransparent)
-
isFreeBind
public boolean isFreeBind()
-
setFreeBind
public IoUringDatagramChannelConfig setFreeBind(boolean freeBind)
-
setMaxDatagramPayloadSize
public IoUringDatagramChannelConfig setMaxDatagramPayloadSize(int maxDatagramSize)
Set the maximumDatagramPacketsize. This will be used to determine if a batch ofIORING_IO_RECVMSGshould be used when reading from the underlying socket. When batchedrecvmmsgis used we may be able to read multipleDatagramPackets with one syscall and so greatly improve the performance. This number will be used to sliceByteBufs returned by the usedRecvByteBufAllocator. You can use0to disable the usage of batching, any other bigger value will enable it.
-
getMaxDatagramPayloadSize
public int getMaxDatagramPayloadSize()
Get the maximumDatagramPacketsize.
-
setIpMulticastAll
public IoUringDatagramChannelConfig setIpMulticastAll(boolean multicastAll)
Iftrueis used IP_MULTICAST_ALL is enabled (or IPV6_MULTICAST_ALL for IPV6),falsefor disable it. Default is enabled.
-
isIpMulticastAll
public boolean isIpMulticastAll()
-
-